From 8cabdbae1e7b78cde00d9727838c9093812bcd55 Mon Sep 17 00:00:00 2001 From: Mike Armstrong Date: Tue, 29 Dec 2015 23:36:34 -0800 Subject: [PATCH] Report jsc memory information to fbsystrace Reviewed By: jspahrsummers Differential Revision: D2789593 fb-gh-sync-id: e31d5f174b9cf896ce3be6431d81264d1d240fdb --- Libraries/Utilities/MessageQueue.js | 1 + Libraries/Utilities/Systrace.js | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/Libraries/Utilities/MessageQueue.js b/Libraries/Utilities/MessageQueue.js index e95dcb385..1bd46424d 100644 --- a/Libraries/Utilities/MessageQueue.js +++ b/Libraries/Utilities/MessageQueue.js @@ -147,6 +147,7 @@ class MessageQueue { this._queue = [[],[],[]]; this._lastFlush = now; } + Systrace.counterEvent('pending_js_to_native_queue', this._queue[0].length); if (__DEV__ && SPY_MODE && isFinite(module)) { console.log('JS->N : ' + this._remoteModuleTable[module] + '.' + this._remoteMethodTable[module][method] + '(' + JSON.stringify(params) + ')'); diff --git a/Libraries/Utilities/Systrace.js b/Libraries/Utilities/Systrace.js index ffd58715d..0e11e8942 100644 --- a/Libraries/Utilities/Systrace.js +++ b/Libraries/Utilities/Systrace.js @@ -92,6 +92,18 @@ var Systrace = { } }, + /** + * counterEvent registers the value to the profileName on the systrace timeline + **/ + counterEvent(profileName?: any, value?: any) { + if (_enabled) { + profileName = typeof profileName === 'function' ? + profileName() : profileName; + global.nativeTraceCounter && + global.nativeTraceCounter(TRACE_TAG_REACT_APPS, profileName, value); + } + }, + reactPerfMeasure(objName: string, fnName: string, func: any): any { return function (component) { if (!_enabled) {