mirror of
https://github.com/status-im/react-native.git
synced 2025-02-25 15:45:32 +00:00
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:
parent
fdbc1e03de
commit
e5b843834d
@ -592,13 +592,13 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RCTProfileBeginEvent(0, @"FetchApplicationScriptCallbacks", nil);
|
RCT_PROFILE_BEGIN_EVENT(0, @"FetchApplicationScriptCallbacks", nil);
|
||||||
[_javaScriptExecutor executeJSCall:@"BatchedBridge"
|
[_javaScriptExecutor executeJSCall:@"BatchedBridge"
|
||||||
method:@"flushedQueue"
|
method:@"flushedQueue"
|
||||||
arguments:@[]
|
arguments:@[]
|
||||||
callback:^(id json, NSError *error)
|
callback:^(id json, NSError *error)
|
||||||
{
|
{
|
||||||
RCTProfileEndEvent(0, @"js_call,init", @{
|
RCT_PROFILE_END_EVENT(0, @"js_call,init", @{
|
||||||
@"json": RCTNullIfNil(json),
|
@"json": RCTNullIfNil(json),
|
||||||
@"error": RCTNullIfNil(error),
|
@"error": RCTNullIfNil(error),
|
||||||
});
|
});
|
||||||
@ -733,7 +733,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
|||||||
|
|
||||||
#if RCT_DEV
|
#if RCT_DEV
|
||||||
NSString *_threadName = RCTCurrentThreadName();
|
NSString *_threadName = RCTCurrentThreadName();
|
||||||
RCTProfileBeginEvent(0, _threadName, nil);
|
RCT_PROFILE_BEGIN_EVENT(0, _threadName, nil);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NSOrderedSet *calls = [buckets objectForKey:queue];
|
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),
|
@"calls": @(calls.count),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -798,7 +798,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
RCTProfileBeginEvent(0, [NSString stringWithFormat:@"[%@ %@]", moduleData.name, method.JSMethodName], nil);
|
RCT_PROFILE_BEGIN_EVENT(0, [NSString stringWithFormat:@"[%@ %@]", moduleData.name, method.JSMethodName], nil);
|
||||||
|
|
||||||
@try {
|
@try {
|
||||||
[method invokeWithBridge:self module:moduleData.instance arguments:params];
|
[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];
|
NSMutableDictionary *args = [method.profileArgs mutableCopy];
|
||||||
args[@"method"] = method.JSMethodName;
|
args[@"method"] = method.JSMethodName;
|
||||||
args[@"args"] = RCTJSONStringify(RCTNullIfNil(params), NULL);
|
args[@"args"] = RCTJSONStringify(RCTNullIfNil(params), NULL);
|
||||||
RCTProfileEndEvent(0, @"objc_call", args);
|
RCT_PROFILE_END_EVENT(0, @"objc_call", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
@ -828,7 +828,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
|||||||
- (void)_jsThreadUpdate:(CADisplayLink *)displayLink
|
- (void)_jsThreadUpdate:(CADisplayLink *)displayLink
|
||||||
{
|
{
|
||||||
RCTAssertJSThread();
|
RCTAssertJSThread();
|
||||||
RCTProfileBeginEvent(0, @"DispatchFrameUpdate", nil);
|
RCT_PROFILE_BEGIN_EVENT(0, @"DispatchFrameUpdate", nil);
|
||||||
|
|
||||||
RCTFrameUpdate *frameUpdate = [[RCTFrameUpdate alloc] initWithDisplayLink:displayLink];
|
RCTFrameUpdate *frameUpdate = [[RCTFrameUpdate alloc] initWithDisplayLink:displayLink];
|
||||||
for (RCTModuleData *moduleData in _frameUpdateObservers) {
|
for (RCTModuleData *moduleData in _frameUpdateObservers) {
|
||||||
@ -839,9 +839,9 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
|||||||
|
|
||||||
[moduleData dispatchBlock:^{
|
[moduleData dispatchBlock:^{
|
||||||
RCTProfileEndFlowEvent();
|
RCTProfileEndFlowEvent();
|
||||||
RCTProfileBeginEvent(0, name, nil);
|
RCT_PROFILE_BEGIN_EVENT(0, name, nil);
|
||||||
[observer didUpdateFrame:frameUpdate];
|
[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');
|
RCTProfileImmediateEvent(0, @"JS Thread Tick", 'g');
|
||||||
|
|
||||||
RCTProfileEndEvent(0, @"objc_call", nil);
|
RCT_PROFILE_END_EVENT(0, @"objc_call", nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)startProfiling
|
- (void)startProfiling
|
||||||
|
@ -192,7 +192,7 @@ static JSValueRef RCTNativeTraceBeginSection(JSContextRef context, __unused JSOb
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (profileName) {
|
if (profileName) {
|
||||||
RCTProfileBeginEvent(tag, profileName, nil);
|
RCT_PROFILE_BEGIN_EVENT(tag, profileName, nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
return JSValueMakeUndefined(context);
|
return JSValueMakeUndefined(context);
|
||||||
@ -202,7 +202,7 @@ static JSValueRef RCTNativeTraceEndSection(JSContextRef context, __unused JSObje
|
|||||||
{
|
{
|
||||||
if (argumentCount > 0) {
|
if (argumentCount > 0) {
|
||||||
double tag = JSValueToNumber(context, arguments[0], exception);
|
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);
|
return JSValueMakeUndefined(context);
|
||||||
|
@ -909,7 +909,7 @@ RCT_EXPORT_METHOD(findSubviewIn:(nonnull NSNumber *)reactTag atPoint:(CGPoint)po
|
|||||||
RCTProfileBeginFlowEvent();
|
RCTProfileBeginFlowEvent();
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
RCTProfileEndFlowEvent();
|
RCTProfileEndFlowEvent();
|
||||||
RCTProfileBeginEvent(0, @"UIManager flushUIBlocks", nil);
|
RCT_PROFILE_BEGIN_EVENT(0, @"UIManager flushUIBlocks", nil);
|
||||||
@try {
|
@try {
|
||||||
for (dispatch_block_t block in previousPendingUIBlocks) {
|
for (dispatch_block_t block in previousPendingUIBlocks) {
|
||||||
block();
|
block();
|
||||||
@ -924,7 +924,7 @@ RCT_EXPORT_METHOD(findSubviewIn:(nonnull NSNumber *)reactTag atPoint:(CGPoint)po
|
|||||||
@catch (NSException *exception) {
|
@catch (NSException *exception) {
|
||||||
RCTLogError(@"Exception thrown while executing UI block: %@", exception);
|
RCTLogError(@"Exception thrown while executing UI block: %@", exception);
|
||||||
}
|
}
|
||||||
RCTProfileEndEvent(0, @"objc_call", @{
|
RCT_PROFILE_END_EVENT(0, @"objc_call", @{
|
||||||
@"count": @(previousPendingUIBlocks.count),
|
@"count": @(previousPendingUIBlocks.count),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -66,7 +66,7 @@ RCT_EXTERN void _RCTProfileBeginEvent(NSThread *calleeThread,
|
|||||||
uint64_t tag,
|
uint64_t tag,
|
||||||
NSString *name,
|
NSString *name,
|
||||||
NSDictionary *args);
|
NSDictionary *args);
|
||||||
#define RCTProfileBeginEvent(...) { \
|
#define RCT_PROFILE_BEGIN_EVENT(...) { \
|
||||||
NSThread *calleeThread = [NSThread currentThread]; \
|
NSThread *calleeThread = [NSThread currentThread]; \
|
||||||
NSTimeInterval time = CACurrentMediaTime(); \
|
NSTimeInterval time = CACurrentMediaTime(); \
|
||||||
dispatch_async(RCTProfileGetQueue(), ^{ \
|
dispatch_async(RCTProfileGetQueue(), ^{ \
|
||||||
@ -86,7 +86,7 @@ RCT_EXTERN void _RCTProfileEndEvent(NSThread *calleeThread,
|
|||||||
NSString *category,
|
NSString *category,
|
||||||
NSDictionary *args);
|
NSDictionary *args);
|
||||||
|
|
||||||
#define RCTProfileEndEvent(...) { \
|
#define RCT_PROFILE_END_EVENT(...) { \
|
||||||
NSThread *calleeThread = [NSThread currentThread]; \
|
NSThread *calleeThread = [NSThread currentThread]; \
|
||||||
NSString *threadName = RCTCurrentThreadName(); \
|
NSString *threadName = RCTCurrentThreadName(); \
|
||||||
NSTimeInterval time = CACurrentMediaTime(); \
|
NSTimeInterval time = CACurrentMediaTime(); \
|
||||||
@ -128,9 +128,9 @@ RCT_EXTERN void RCTProfileImmediateEvent(uint64_t tag,
|
|||||||
*/
|
*/
|
||||||
#define RCTProfileBlock(block, tag, category, arguments) \
|
#define RCTProfileBlock(block, tag, category, arguments) \
|
||||||
^{ \
|
^{ \
|
||||||
RCTProfileBeginEvent(tag, @(__PRETTY_FUNCTION__), nil); \
|
RCT_PROFILE_BEGIN_EVENT(tag, @(__PRETTY_FUNCTION__), nil); \
|
||||||
block(); \
|
block(); \
|
||||||
RCTProfileEndEvent(tag, category, arguments); \
|
RCT_PROFILE_END_EVENT(tag, category, arguments); \
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -189,8 +189,11 @@ RCT_EXTERN void RCTProfileRegisterCallbacks(RCTProfileCallbacks *);
|
|||||||
#define RCTProfileInit(...)
|
#define RCTProfileInit(...)
|
||||||
#define RCTProfileEnd(...) @""
|
#define RCTProfileEnd(...) @""
|
||||||
|
|
||||||
#define RCTProfileBeginEvent(...)
|
#define _RCTProfileBeginEvent(...)
|
||||||
#define RCTProfileEndEvent(...)
|
#define _RCTProfileEndEvent(...)
|
||||||
|
|
||||||
|
#define RCT_PROFILE_BEGIN_EVENT(...)
|
||||||
|
#define RCT_PROFILE_END_EVENT(...)
|
||||||
|
|
||||||
#define RCTProfileBeginAsyncEvent(...) 0
|
#define RCTProfileBeginAsyncEvent(...) 0
|
||||||
#define RCTProfileEndAsyncEvent(...)
|
#define RCTProfileEndAsyncEvent(...)
|
||||||
|
@ -190,13 +190,13 @@ RCT_EXTERN void RCTProfileTrampolineStart(id, SEL);
|
|||||||
void RCTProfileTrampolineStart(id self, SEL cmd)
|
void RCTProfileTrampolineStart(id self, SEL cmd)
|
||||||
{
|
{
|
||||||
NSString *name = [NSString stringWithFormat:@"-[%s %s]", class_getName([self class]), sel_getName(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);
|
RCT_EXTERN void RCTProfileTrampolineEnd(void);
|
||||||
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)
|
void RCTProfileHookModules(RCTBridge *bridge)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user