mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 11:34:23 +00:00
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
This commit is contained in:
parent
d7fc58f32c
commit
c25e48abfc
@ -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);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user