Improve systrace markers

Reviewed By: jspahrsummers

Differential Revision: D2851737

fb-gh-sync-id: 4aa0872e7d56d59de2fa42b87a795b2d64e0faa0
This commit is contained in:
Pieter De Baets
2016-02-03 07:10:52 -08:00
committed by facebook-github-bot-7
parent fff4688423
commit 41f5a21b56
5 changed files with 33 additions and 24 deletions

View File

@@ -189,7 +189,7 @@ RCT_EXTERN NSArray<Class> *RCTGetModuleClasses(void);
(void)cookie;
RCTSourceLoadBlock onSourceLoad = ^(NSError *error, NSData *source) {
RCTProfileEndAsyncEvent(0, @"init,download", cookie, @"JavaScript download", nil);
RCTProfileEndAsyncEvent(0, @"native", cookie, @"JavaScript download", @"JS async", nil);
RCTPerformanceLoggerEnd(RCTPLScriptDownload);
_onSourceLoad(error, source);
@@ -629,6 +629,8 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
* AnyThread
*/
RCT_PROFILE_BEGIN_EVENT(0, @"-[RCTBatchedBridge enqueueJSCall:]", nil);
NSArray<NSString *> *ids = [moduleDotMethod componentsSeparatedByString:@"."];
NSString *module = ids[0];
@@ -654,6 +656,8 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
[strongSelf _actuallyInvokeAndProcessModule:module method:method arguments:args ?: @[]];
}
}];
RCT_PROFILE_END_EVENT(0, @"", nil);
}
/**
@@ -843,8 +847,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
dispatch_block_t block = ^{
RCTProfileEndFlowEvent();
RCT_PROFILE_BEGIN_EVENT(0, RCTCurrentThreadName(), nil);
RCT_PROFILE_BEGIN_EVENT(0, @"-[RCTBatchedBridge handleBuffer:]", nil);
NSOrderedSet *calls = [buckets objectForKey:queue];
@autoreleasepool {
@@ -940,14 +943,13 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
- (void)_jsThreadUpdate:(CADisplayLink *)displayLink
{
RCTAssertJSThread();
RCT_PROFILE_BEGIN_EVENT(0, @"DispatchFrameUpdate", nil);
RCT_PROFILE_BEGIN_EVENT(0, @"-[RCTBatchedBridge _jsThreadUpdate:]", nil);
RCTFrameUpdate *frameUpdate = [[RCTFrameUpdate alloc] initWithDisplayLink:displayLink];
for (RCTModuleData *moduleData in _frameUpdateObservers) {
id<RCTFrameUpdateObserver> observer = (id<RCTFrameUpdateObserver>)moduleData.instance;
if (!observer.paused) {
RCTProfileBeginFlowEvent();
[self dispatchBlock:^{
RCTProfileEndFlowEvent();
[observer didUpdateFrame:frameUpdate];

View File

@@ -25,6 +25,7 @@
#import "RCTUtils.h"
#import "RCTView.h"
#import "UIView+React.h"
#import "RCTProfile.h"
NSString *const RCTContentDidAppearNotification = @"RCTContentDidAppearNotification";
@@ -60,6 +61,8 @@ NSString *const RCTContentDidAppearNotification = @"RCTContentDidAppearNotificat
RCTAssert(bridge, @"A bridge instance is required to create an RCTRootView");
RCTAssert(moduleName, @"A moduleName is required to create an RCTRootView");
RCT_PROFILE_BEGIN_EVENT(0, @"-[RCTRootView init]", nil);
if ((self = [super initWithFrame:CGRectZero])) {
self.backgroundColor = [UIColor whiteColor];
@@ -86,6 +89,9 @@ NSString *const RCTContentDidAppearNotification = @"RCTContentDidAppearNotificat
[self showLoadingView];
}
RCT_PROFILE_END_EVENT(0, @"", nil);
return self;
}
@@ -174,10 +180,10 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
[_contentView removeFromSuperview];
_contentView = [[RCTRootContentView alloc] initWithFrame:self.bounds bridge:bridge];
[self runApplication:bridge];
_contentView.backgroundColor = self.backgroundColor;
[self insertSubview:_contentView atIndex:0];
[self runApplication:bridge];
}
- (void)runApplication:(RCTBridge *)bridge