Support flow events in RCTProfile
Summary: Add begin/end async flow to the callbacks for external profiling Reviewed By: tadeuzagallo Differential Revision: D3234812 fbshipit-source-id: cdbe46883fd566d50a04de9ad67f947876a78a0c
This commit is contained in:
parent
05832c3469
commit
418e16f711
|
@ -187,6 +187,9 @@ typedef struct {
|
|||
void (*end_async_section)(uint64_t tag, const char *name, int cookie, size_t numArgs, systrace_arg_t *args);
|
||||
|
||||
void (*instant_section)(uint64_t tag, const char *name, char scope);
|
||||
|
||||
void (*begin_async_flow)(uint64_t tag, const char *name, int cookie);
|
||||
void (*end_async_flow)(uint64_t tag, const char *name, int cookie);
|
||||
} RCTProfileCallbacks;
|
||||
|
||||
RCT_EXTERN void RCTProfileRegisterCallbacks(RCTProfileCallbacks *);
|
||||
|
|
|
@ -696,13 +696,15 @@ NSNumber *_RCTProfileBeginFlowEvent(void)
|
|||
|
||||
CHECK(@0);
|
||||
|
||||
unsigned int cookie = ++flowID;
|
||||
NSNumber *currentID = @(cookie);
|
||||
|
||||
if (callbacks != NULL) {
|
||||
// flow events not supported yet
|
||||
return @0;
|
||||
callbacks->begin_async_flow(1, "flow", cookie);
|
||||
return currentID;
|
||||
}
|
||||
|
||||
NSTimeInterval time = CACurrentMediaTime();
|
||||
NSNumber *currentID = @(++flowID);
|
||||
NSString *threadName = RCTCurrentThreadName();
|
||||
|
||||
dispatch_async(RCTProfileGetQueue(), ^{
|
||||
|
@ -725,6 +727,7 @@ void _RCTProfileEndFlowEvent(NSNumber *flowID)
|
|||
CHECK();
|
||||
|
||||
if (callbacks != NULL) {
|
||||
callbacks->end_async_flow(1, "flow", [flowID integerValue]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue