mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 01:40:08 +00:00
fix RCTPerfMonitor display unit error
Summary:The RCTPerformanceLogger log the time in ms not us. Especially the unit of RCTPLBundleSize is byte. Closes https://github.com/facebook/react-native/pull/5919 Differential Revision: D2982116 Pulled By: nicklockwood fb-gh-sync-id: 18aad5ff2eb83c6f302b2c10382bf214b51df133 shipit-source-id: 18aad5ff2eb83c6f302b2c10382bf214b51df133
This commit is contained in:
parent
251d5a5959
commit
50141f9d3f
@ -24,11 +24,12 @@ var PerformanceOverlay = React.createClass({
|
||||
|
||||
for (var key in perfLogs) {
|
||||
if (perfLogs[key].totalTime) {
|
||||
var unit = (key === 'BundleSize') ? 'b' : 'ms';
|
||||
items.push(
|
||||
<View style={styles.row}>
|
||||
<Text style={[styles.text, styles.label]}>{key}</Text>
|
||||
<Text style={[styles.text, styles.totalTime]}>
|
||||
{perfLogs[key].totalTime + 'ms'}
|
||||
{perfLogs[key].totalTime + unit}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
|
@ -501,12 +501,13 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (void)loadPerformanceLoggerData
|
||||
{
|
||||
NSMutableArray *data = [NSMutableArray new];
|
||||
NSArray *times = RCTPerformanceLoggerOutput();
|
||||
NSUInteger i = 0;
|
||||
NSMutableArray<NSString *> *data = [NSMutableArray new];
|
||||
NSArray<NSNumber *> *values = RCTPerformanceLoggerOutput();
|
||||
for (NSString *label in RCTPerformanceLoggerLabels()) {
|
||||
[data addObject:[NSString stringWithFormat:@"%@: %lldus", label,
|
||||
[times[i+1] longLongValue] - [times[i] longLongValue]]];
|
||||
long long value = values[i+1].longLongValue - values[i].longLongValue;
|
||||
NSString *unit = [label isEqualToString:@"BundleSize"] ? @"b" : @"ms";
|
||||
[data addObject:[NSString stringWithFormat:@"%@: %lld%@", label, value, unit]];
|
||||
i += 2;
|
||||
}
|
||||
_perfLoggerMarks = [data copy];
|
||||
|
Loading…
x
Reference in New Issue
Block a user