Rename RCTProfile(Begin|End)Event

Summary: public

Rename it to `RCT_PROFILE_(BEGIN|END)_EVENT` to make it clearer that it's a macro,
since it has special behaviours.

Reviewed By: jspahrsummers

Differential Revision: D2631542

fb-gh-sync-id: 629c139462c4aa3582f719b14482017d13676e33
This commit is contained in:
Tadeu Zagallo 2015-11-09 08:42:51 -08:00 committed by facebook-github-bot-6
parent fdbc1e03de
commit e5b843834d
5 changed files with 25 additions and 22 deletions

View File

@ -592,13 +592,13 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
return;
}
RCTProfileBeginEvent(0, @"FetchApplicationScriptCallbacks", nil);
RCT_PROFILE_BEGIN_EVENT(0, @"FetchApplicationScriptCallbacks", nil);
[_javaScriptExecutor executeJSCall:@"BatchedBridge"
method:@"flushedQueue"
arguments:@[]
callback:^(id json, NSError *error)
{
RCTProfileEndEvent(0, @"js_call,init", @{
RCT_PROFILE_END_EVENT(0, @"js_call,init", @{
@"json": RCTNullIfNil(json),
@"error": RCTNullIfNil(error),
});
@ -733,7 +733,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
#if RCT_DEV
NSString *_threadName = RCTCurrentThreadName();
RCTProfileBeginEvent(0, _threadName, nil);
RCT_PROFILE_BEGIN_EVENT(0, _threadName, nil);
#endif
NSOrderedSet *calls = [buckets objectForKey:queue];
@ -747,7 +747,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
}
}
RCTProfileEndEvent(0, @"objc_call,dispatch_async", @{
RCT_PROFILE_END_EVENT(0, @"objc_call,dispatch_async", @{
@"calls": @(calls.count),
});
};
@ -798,7 +798,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
return NO;
}
RCTProfileBeginEvent(0, [NSString stringWithFormat:@"[%@ %@]", moduleData.name, method.JSMethodName], nil);
RCT_PROFILE_BEGIN_EVENT(0, [NSString stringWithFormat:@"[%@ %@]", moduleData.name, method.JSMethodName], nil);
@try {
[method invokeWithBridge:self module:moduleData.instance arguments:params];
@ -819,7 +819,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
NSMutableDictionary *args = [method.profileArgs mutableCopy];
args[@"method"] = method.JSMethodName;
args[@"args"] = RCTJSONStringify(RCTNullIfNil(params), NULL);
RCTProfileEndEvent(0, @"objc_call", args);
RCT_PROFILE_END_EVENT(0, @"objc_call", args);
}
return YES;
@ -828,7 +828,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
- (void)_jsThreadUpdate:(CADisplayLink *)displayLink
{
RCTAssertJSThread();
RCTProfileBeginEvent(0, @"DispatchFrameUpdate", nil);
RCT_PROFILE_BEGIN_EVENT(0, @"DispatchFrameUpdate", nil);
RCTFrameUpdate *frameUpdate = [[RCTFrameUpdate alloc] initWithDisplayLink:displayLink];
for (RCTModuleData *moduleData in _frameUpdateObservers) {
@ -839,9 +839,9 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
[moduleData dispatchBlock:^{
RCTProfileEndFlowEvent();
RCTProfileBeginEvent(0, name, nil);
RCT_PROFILE_BEGIN_EVENT(0, name, nil);
[observer didUpdateFrame:frameUpdate];
RCTProfileEndEvent(0, @"objc_call,fps", nil);
RCT_PROFILE_END_EVENT(0, @"objc_call,fps", nil);
}];
}
}
@ -851,7 +851,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
RCTProfileImmediateEvent(0, @"JS Thread Tick", 'g');
RCTProfileEndEvent(0, @"objc_call", nil);
RCT_PROFILE_END_EVENT(0, @"objc_call", nil);
}
- (void)startProfiling

View File

@ -192,7 +192,7 @@ static JSValueRef RCTNativeTraceBeginSection(JSContextRef context, __unused JSOb
}
if (profileName) {
RCTProfileBeginEvent(tag, profileName, nil);
RCT_PROFILE_BEGIN_EVENT(tag, profileName, nil);
}
return JSValueMakeUndefined(context);
@ -202,7 +202,7 @@ static JSValueRef RCTNativeTraceEndSection(JSContextRef context, __unused JSObje
{
if (argumentCount > 0) {
double tag = JSValueToNumber(context, arguments[0], exception);
RCTProfileEndEvent((uint64_t)tag, @"console", nil);
RCT_PROFILE_END_EVENT((uint64_t)tag, @"console", nil);
}
return JSValueMakeUndefined(context);

View File

@ -909,7 +909,7 @@ RCT_EXPORT_METHOD(findSubviewIn:(nonnull NSNumber *)reactTag atPoint:(CGPoint)po
RCTProfileBeginFlowEvent();
dispatch_async(dispatch_get_main_queue(), ^{
RCTProfileEndFlowEvent();
RCTProfileBeginEvent(0, @"UIManager flushUIBlocks", nil);
RCT_PROFILE_BEGIN_EVENT(0, @"UIManager flushUIBlocks", nil);
@try {
for (dispatch_block_t block in previousPendingUIBlocks) {
block();
@ -924,7 +924,7 @@ RCT_EXPORT_METHOD(findSubviewIn:(nonnull NSNumber *)reactTag atPoint:(CGPoint)po
@catch (NSException *exception) {
RCTLogError(@"Exception thrown while executing UI block: %@", exception);
}
RCTProfileEndEvent(0, @"objc_call", @{
RCT_PROFILE_END_EVENT(0, @"objc_call", @{
@"count": @(previousPendingUIBlocks.count),
});
});

View File

@ -66,7 +66,7 @@ RCT_EXTERN void _RCTProfileBeginEvent(NSThread *calleeThread,
uint64_t tag,
NSString *name,
NSDictionary *args);
#define RCTProfileBeginEvent(...) { \
#define RCT_PROFILE_BEGIN_EVENT(...) { \
NSThread *calleeThread = [NSThread currentThread]; \
NSTimeInterval time = CACurrentMediaTime(); \
dispatch_async(RCTProfileGetQueue(), ^{ \
@ -86,7 +86,7 @@ RCT_EXTERN void _RCTProfileEndEvent(NSThread *calleeThread,
NSString *category,
NSDictionary *args);
#define RCTProfileEndEvent(...) { \
#define RCT_PROFILE_END_EVENT(...) { \
NSThread *calleeThread = [NSThread currentThread]; \
NSString *threadName = RCTCurrentThreadName(); \
NSTimeInterval time = CACurrentMediaTime(); \
@ -128,9 +128,9 @@ RCT_EXTERN void RCTProfileImmediateEvent(uint64_t tag,
*/
#define RCTProfileBlock(block, tag, category, arguments) \
^{ \
RCTProfileBeginEvent(tag, @(__PRETTY_FUNCTION__), nil); \
RCT_PROFILE_BEGIN_EVENT(tag, @(__PRETTY_FUNCTION__), nil); \
block(); \
RCTProfileEndEvent(tag, category, arguments); \
RCT_PROFILE_END_EVENT(tag, category, arguments); \
}
/**
@ -189,8 +189,11 @@ RCT_EXTERN void RCTProfileRegisterCallbacks(RCTProfileCallbacks *);
#define RCTProfileInit(...)
#define RCTProfileEnd(...) @""
#define RCTProfileBeginEvent(...)
#define RCTProfileEndEvent(...)
#define _RCTProfileBeginEvent(...)
#define _RCTProfileEndEvent(...)
#define RCT_PROFILE_BEGIN_EVENT(...)
#define RCT_PROFILE_END_EVENT(...)
#define RCTProfileBeginAsyncEvent(...) 0
#define RCTProfileEndAsyncEvent(...)

View File

@ -190,13 +190,13 @@ RCT_EXTERN void RCTProfileTrampolineStart(id, SEL);
void RCTProfileTrampolineStart(id self, SEL cmd)
{
NSString *name = [NSString stringWithFormat:@"-[%s %s]", class_getName([self class]), sel_getName(cmd)];
RCTProfileBeginEvent(0, name, nil);
RCT_PROFILE_BEGIN_EVENT(0, name, nil);
}
RCT_EXTERN void RCTProfileTrampolineEnd(void);
void RCTProfileTrampolineEnd(void)
{
RCTProfileEndEvent(0, @"objc_call,modules,auto", nil);
RCT_PROFILE_END_EVENT(0, @"objc_call,modules,auto", nil);
}
void RCTProfileHookModules(RCTBridge *bridge)