From 02daffbe9d8dc15191becf3d2bca3afa99d4242e Mon Sep 17 00:00:00 2001 From: Aaron Chiu Date: Tue, 21 Feb 2017 22:12:35 -0800 Subject: [PATCH] print out Performance markers to console Differential Revision: D4585709 fbshipit-source-id: fe1f1f6b146854aa426e6186baf73ac2cf1784c8 --- Libraries/Utilities/PerformanceLogger.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Libraries/Utilities/PerformanceLogger.js b/Libraries/Utilities/PerformanceLogger.js index 8772a2ae0..fd77037d8 100644 --- a/Libraries/Utilities/PerformanceLogger.js +++ b/Libraries/Utilities/PerformanceLogger.js @@ -18,6 +18,8 @@ var timespans = {}; var extras = {}; var cookies = {}; +const PRINT_TO_CONSOLE = false; + /** * This is meant to collect and log performance data in production, which means * it needs to have minimal overhead. @@ -56,6 +58,9 @@ var PerformanceLogger = { startTime: performanceNow(), }; cookies[key] = Systrace.beginAsyncEvent(key); + if (__DEV__ && PRINT_TO_CONSOLE) { + console.log('PerformanceLogger.js', 'start: ' + key); + } }, stopTimespan(key) { @@ -78,6 +83,9 @@ var PerformanceLogger = { return; } + if (__DEV__ && PRINT_TO_CONSOLE) { + console.log('PerformanceLogger.js', 'end: ' + key); + } Systrace.endAsyncEvent(key, cookies[key]); delete cookies[key]; timespans[key].endTime = performanceNow();