print out Performance markers to console
Differential Revision: D4585709 fbshipit-source-id: fe1f1f6b146854aa426e6186baf73ac2cf1784c8
This commit is contained in:
parent
a0da13322b
commit
02daffbe9d
|
@ -18,6 +18,8 @@ var timespans = {};
|
||||||
var extras = {};
|
var extras = {};
|
||||||
var cookies = {};
|
var cookies = {};
|
||||||
|
|
||||||
|
const PRINT_TO_CONSOLE = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is meant to collect and log performance data in production, which means
|
* This is meant to collect and log performance data in production, which means
|
||||||
* it needs to have minimal overhead.
|
* it needs to have minimal overhead.
|
||||||
|
@ -56,6 +58,9 @@ var PerformanceLogger = {
|
||||||
startTime: performanceNow(),
|
startTime: performanceNow(),
|
||||||
};
|
};
|
||||||
cookies[key] = Systrace.beginAsyncEvent(key);
|
cookies[key] = Systrace.beginAsyncEvent(key);
|
||||||
|
if (__DEV__ && PRINT_TO_CONSOLE) {
|
||||||
|
console.log('PerformanceLogger.js', 'start: ' + key);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
stopTimespan(key) {
|
stopTimespan(key) {
|
||||||
|
@ -78,6 +83,9 @@ var PerformanceLogger = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (__DEV__ && PRINT_TO_CONSOLE) {
|
||||||
|
console.log('PerformanceLogger.js', 'end: ' + key);
|
||||||
|
}
|
||||||
Systrace.endAsyncEvent(key, cookies[key]);
|
Systrace.endAsyncEvent(key, cookies[key]);
|
||||||
delete cookies[key];
|
delete cookies[key];
|
||||||
timespans[key].endTime = performanceNow();
|
timespans[key].endTime = performanceNow();
|
||||||
|
|
Loading…
Reference in New Issue