[cg] Perf logging

This commit is contained in:
Martín Bigio 2015-07-16 14:08:25 -07:00
parent fca16fbe40
commit ab9a87c33a
1 changed files with 10 additions and 3 deletions

View File

@ -24,7 +24,8 @@ var PerformanceLogger = {
if (timespans[key]) { if (timespans[key]) {
if (__DEV__) { if (__DEV__) {
console.log( console.log(
'PerformanceLogger: Attempting to add a timespan that already exists' 'PerformanceLogger: Attempting to add a timespan that already exists ',
key
); );
} }
return; return;
@ -40,7 +41,8 @@ var PerformanceLogger = {
if (timespans[key]) { if (timespans[key]) {
if (__DEV__) { if (__DEV__) {
console.log( console.log(
'PerformanceLogger: Attempting to start a timespan that already exists' 'PerformanceLogger: Attempting to start a timespan that already exists ',
key,
); );
} }
return; return;
@ -56,7 +58,8 @@ var PerformanceLogger = {
if (!timespans[key] || !timespans[key].startTime) { if (!timespans[key] || !timespans[key].startTime) {
if (__DEV__) { if (__DEV__) {
console.log( console.log(
'PerformanceLogger: Attempting to end a timespan that has not started' 'PerformanceLogger: Attempting to end a timespan that has not started ',
key,
); );
} }
return; return;
@ -75,6 +78,10 @@ var PerformanceLogger = {
return timespans; return timespans;
}, },
hasTimespan(key) {
return !!timespans[key];
},
logTimespans() { logTimespans() {
for (var key in timespans) { for (var key in timespans) {
console.log(key + ': ' + timespans[key].totalTime + 'ms'); console.log(key + ': ' + timespans[key].totalTime + 'ms');