Added a graph view and a ReactNative metric that displays current queue and execution time for the JS thread.
This commit is contained in:
parent
e4990939e4
commit
ac8cd5a5d0
|
@ -657,21 +657,11 @@ static id<RCTJavaScriptExecutor> _latestJSExecutor;
|
||||||
|
|
||||||
- (void)_invokeAndProcessModule:(NSString *)module method:(NSString *)method arguments:(NSArray *)args
|
- (void)_invokeAndProcessModule:(NSString *)module method:(NSString *)method arguments:(NSArray *)args
|
||||||
{
|
{
|
||||||
NSTimeInterval startJS = RCTTGetAbsoluteTime();
|
[[NSNotificationCenter defaultCenter] postNotificationName:@"JS_PERF_ENQUEUE" object:nil userInfo:nil];
|
||||||
|
|
||||||
RCTJavaScriptCallback processResponse = ^(id json, NSError *error) {
|
RCTJavaScriptCallback processResponse = ^(id json, NSError *error) {
|
||||||
NSTimeInterval startNative = RCTTGetAbsoluteTime();
|
[[NSNotificationCenter defaultCenter] postNotificationName:@"JS_PERF_DEQUEUE" object:nil userInfo:nil];
|
||||||
[self _handleBuffer:json];
|
[self _handleBuffer:json];
|
||||||
|
|
||||||
NSTimeInterval end = RCTTGetAbsoluteTime();
|
|
||||||
NSTimeInterval timeJS = startNative - startJS;
|
|
||||||
NSTimeInterval timeNative = end - startNative;
|
|
||||||
|
|
||||||
// TODO: surface this performance information somewhere
|
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"PERF" object:nil userInfo:@{
|
|
||||||
@"JS": @(timeJS * 1000000),
|
|
||||||
@"Native": @(timeNative * 1000000)
|
|
||||||
}];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
[_javaScriptExecutor executeJSCall:module
|
[_javaScriptExecutor executeJSCall:module
|
||||||
|
|
Loading…
Reference in New Issue