From c25e48abfc9489f346aa5932517d68ce1becaa2a Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Mon, 13 Jun 2016 04:18:33 -0700 Subject: [PATCH] Allow additional information to be passed to systrace events Summary: Expose the ability to provide extra information to Systrace events from JS. This is specifically useful for instrumenting generic recursive method that are defined completely through their params. Reviewed By: tadeuzagallo Differential Revision: D3423595 fbshipit-source-id: 7f2dedf02bf901401a6b391b85b1a0bb6782349c --- Libraries/Utilities/Systrace.js | 4 ++-- React/Executors/RCTJSCExecutor.mm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Libraries/Utilities/Systrace.js b/Libraries/Utilities/Systrace.js index bdd2c599262..6c23a7e1160 100644 --- a/Libraries/Utilities/Systrace.js +++ b/Libraries/Utilities/Systrace.js @@ -66,11 +66,11 @@ const Systrace = { /** * beginEvent/endEvent for starting and then ending a profile within the same call stack frame **/ - beginEvent(profileName?: any) { + beginEvent(profileName?: any, args?: any) { if (_enabled) { profileName = typeof profileName === 'function' ? profileName() : profileName; - global.nativeTraceBeginSection(TRACE_TAG_REACT_APPS, profileName); + global.nativeTraceBeginSection(TRACE_TAG_REACT_APPS, profileName, args); } }, diff --git a/React/Executors/RCTJSCExecutor.mm b/React/Executors/RCTJSCExecutor.mm index 25272fd782f..921225f7890 100644 --- a/React/Executors/RCTJSCExecutor.mm +++ b/React/Executors/RCTJSCExecutor.mm @@ -415,13 +415,13 @@ static void RCTInstallJSCProfiler(RCTBridge *bridge, JSContextRef context) CFDictionaryRemoveValue(strongSelf->_cookieMap, (const void *)cookie); }]; - [self addSynchronousHookWithName:@"nativeTraceBeginSection" usingBlock:^(NSNumber *tag, NSString *profileName){ + [self addSynchronousHookWithName:@"nativeTraceBeginSection" usingBlock:^(NSNumber *tag, NSString *profileName, NSDictionary *args) { static int profileCounter = 1; if (!profileName) { profileName = [NSString stringWithFormat:@"Profile %d", profileCounter++]; } - RCT_PROFILE_BEGIN_EVENT(tag.longLongValue, profileName, nil); + RCT_PROFILE_BEGIN_EVENT(tag.longLongValue, profileName, args); }]; [self addSynchronousHookWithName:@"nativeTraceEndSection" usingBlock:^(NSNumber *tag) {