Remove last arg from RCTProfileEnd, make macro's function-like
Reviewed By: tadeuzagallo Differential Revision: D3801302 fbshipit-source-id: 297a58db876366e21e232094c1361aa0dcd9016d
This commit is contained in:
parent
3f5a263307
commit
1a7c231ef3
|
@ -146,7 +146,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithDelegate:(id<RCTBridgeDelegate>)dele
|
|||
[performanceLogger markStartForTag:RCTPLNativeModulePrepareConfig];
|
||||
config = [weakSelf moduleConfig];
|
||||
[performanceLogger markStopForTag:RCTPLNativeModulePrepareConfig];
|
||||
RCT_PROFILE_END_EVENT(0, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -174,7 +174,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithDelegate:(id<RCTBridgeDelegate>)dele
|
|||
}
|
||||
});
|
||||
|
||||
RCT_PROFILE_END_EVENT(0, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
}
|
||||
|
||||
- (void)loadSource:(RCTSourceLoadBlock)_onSourceLoad
|
||||
|
@ -334,7 +334,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithDelegate:(id<RCTBridgeDelegate>)dele
|
|||
_javaScriptExecutor = (id<RCTJavaScriptExecutor>)module;
|
||||
}
|
||||
}
|
||||
RCT_PROFILE_END_EVENT(0, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
|
||||
// The executor is a bridge module, but we want it to be instantiated before
|
||||
// any other module has access to the bridge, in case they need the JS thread.
|
||||
|
@ -352,7 +352,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithDelegate:(id<RCTBridgeDelegate>)dele
|
|||
// NOTE: _javaScriptExecutor is a weak reference
|
||||
_javaScriptExecutor = executorModule;
|
||||
}
|
||||
RCT_PROFILE_END_EVENT(0, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
|
||||
// Set up moduleData for automatically-exported modules
|
||||
RCT_PROFILE_BEGIN_EVENT(0, @"ModuleData", nil);
|
||||
|
@ -388,7 +388,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithDelegate:(id<RCTBridgeDelegate>)dele
|
|||
_moduleDataByID = [moduleDataByID copy];
|
||||
_moduleDataByName = [moduleDataByName copy];
|
||||
_moduleClassesByID = [moduleClassesByID copy];
|
||||
RCT_PROFILE_END_EVENT(0, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
|
||||
// Synchronously set up the pre-initialized modules
|
||||
RCT_PROFILE_BEGIN_EVENT(0, @"extraModules", nil);
|
||||
|
@ -404,7 +404,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithDelegate:(id<RCTBridgeDelegate>)dele
|
|||
(void)[moduleData instance];
|
||||
}
|
||||
}
|
||||
RCT_PROFILE_END_EVENT(0, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
|
||||
// From this point on, RCTDidInitializeModuleNotification notifications will
|
||||
// be sent the first time a module is accessed.
|
||||
|
@ -413,7 +413,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithDelegate:(id<RCTBridgeDelegate>)dele
|
|||
[self prepareModulesWithDispatchGroup:dispatchGroup];
|
||||
|
||||
[_performanceLogger markStopForTag:RCTPLNativeModuleInit];
|
||||
RCT_PROFILE_END_EVENT(0, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
}
|
||||
|
||||
- (void)prepareModulesWithDispatchGroup:(dispatch_group_t)dispatchGroup
|
||||
|
@ -471,7 +471,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithDelegate:(id<RCTBridgeDelegate>)dele
|
|||
}
|
||||
|
||||
[_performanceLogger setValue:_modulesInitializedOnMainQueue forTag:RCTPLNativeModuleMainThreadUsesCount];
|
||||
RCT_PROFILE_END_EVENT(0, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
}
|
||||
|
||||
- (void)whitelistedModulesDidChange
|
||||
|
@ -580,7 +580,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithDelegate:(id<RCTBridgeDelegate>)dele
|
|||
for (dispatch_block_t call in pendingCalls) {
|
||||
call();
|
||||
}
|
||||
RCT_PROFILE_END_EVENT(0, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
}
|
||||
|
||||
- (void)stopLoadingWithError:(NSError *)error
|
||||
|
@ -676,7 +676,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
|||
block();
|
||||
}
|
||||
|
||||
RCT_PROFILE_END_EVENT(0, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
}];
|
||||
} else if (queue) {
|
||||
dispatch_async(queue, block);
|
||||
|
@ -780,7 +780,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
|||
completion();
|
||||
}
|
||||
} queue:RCTJSThread];
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -833,13 +833,8 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
|||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"FetchApplicationScriptCallbacks", nil);
|
||||
[self->_javaScriptExecutor flushedQueue:^(id json, NSError *error)
|
||||
{
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"js_call,init", @{
|
||||
@"json": RCTNullIfNil(json),
|
||||
@"error": RCTNullIfNil(error),
|
||||
});
|
||||
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"js_call,init");
|
||||
[self handleBuffer:json batchEnded:YES];
|
||||
|
||||
onComplete(error);
|
||||
}];
|
||||
}];
|
||||
|
@ -957,9 +952,12 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
|||
|
||||
dispatch_block_t block = ^{
|
||||
RCTProfileEndFlowEvent();
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"-[RCTBatchedBridge handleBuffer:]", nil);
|
||||
|
||||
NSOrderedSet *calls = [buckets objectForKey:queue];
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"-[RCTBatchedBridge handleBuffer:]", (@{
|
||||
@"calls": @(calls.count),
|
||||
}));
|
||||
|
||||
@autoreleasepool {
|
||||
for (NSNumber *indexObj in calls) {
|
||||
NSUInteger index = indexObj.unsignedIntegerValue;
|
||||
|
@ -978,9 +976,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
|||
}
|
||||
}
|
||||
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"objc_call,dispatch_async", @{
|
||||
@"calls": @(calls.count),
|
||||
});
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"objc_call,dispatch_async");
|
||||
};
|
||||
|
||||
[self dispatchBlock:block queue:queue];
|
||||
|
|
|
@ -251,7 +251,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
|||
|
||||
[self createBatchedBridge];
|
||||
|
||||
RCT_PROFILE_END_EVENT(0, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
}
|
||||
|
||||
- (void)createBatchedBridge
|
||||
|
|
|
@ -127,7 +127,7 @@
|
|||
|
||||
RCTProfileImmediateEvent(RCTProfileTagAlways, @"JS Thread Tick", displayLink.timestamp, 'g');
|
||||
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"objc_call", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"objc_call");
|
||||
}
|
||||
|
||||
- (void)updateJSDisplayLinkState
|
||||
|
|
|
@ -94,7 +94,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init);
|
|||
}
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"[RCTModuleData setUpInstanceAndBridge] [_moduleClass new]", @{ @"moduleClass": NSStringFromClass(_moduleClass) });
|
||||
_instance = [_moduleClass new];
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
if (!_instance) {
|
||||
// Module init returned nil, probably because automatic instantatiation
|
||||
// of the module is not supported, and it is supposed to be passed in to
|
||||
|
@ -118,7 +118,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init);
|
|||
|
||||
[self setUpMethodQueue];
|
||||
}
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
|
||||
// This is called outside of the lock in order to prevent deadlock issues
|
||||
// because the logic in `finishSetupForInstance` can cause
|
||||
|
@ -151,7 +151,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init);
|
|||
"permitted. You must either @synthesize the bridge property, "
|
||||
"or provide your own setter method.", self.name);
|
||||
}
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init);
|
|||
[[NSNotificationCenter defaultCenter] postNotificationName:RCTDidInitializeModuleNotification
|
||||
object:_bridge
|
||||
userInfo:@{@"module": _instance}];
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init);
|
|||
}
|
||||
}
|
||||
}
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init);
|
|||
- (id<RCTBridgeModule>)instance
|
||||
{
|
||||
if (!_setupComplete) {
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, [NSString stringWithFormat:@"[RCTModuleData instanceForClass:%@]", _moduleClass], nil);
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, ([NSString stringWithFormat:@"[RCTModuleData instanceForClass:%@]", _moduleClass]), nil);
|
||||
if (_requiresMainQueueSetup) {
|
||||
// The chances of deadlock here are low, because module init very rarely
|
||||
// calls out to other threads, however we can't control when a module might
|
||||
|
@ -225,11 +225,11 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init);
|
|||
[self setUpInstanceAndBridge];
|
||||
}, YES);
|
||||
#pragma clang diagnostic pop
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
} else {
|
||||
[self setUpInstanceAndBridge];
|
||||
}
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init);
|
|||
- (void)gatherConstants
|
||||
{
|
||||
if (_hasConstantsToExport && !_constantsToExport) {
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, [NSString stringWithFormat:@"[RCTModuleData gatherConstants] %@", _moduleClass], nil);
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, ([NSString stringWithFormat:@"[RCTModuleData gatherConstants] %@", _moduleClass]), nil);
|
||||
(void)[self instance];
|
||||
if (!RCTIsMainQueue()) {
|
||||
RCTLogWarn(@"Required dispatch_sync to load constants for %@. This may lead to deadlocks", _moduleClass);
|
||||
|
@ -292,7 +292,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init);
|
|||
self->_constantsToExport = [self->_instance constantsToExport] ?: @{};
|
||||
}, YES);
|
||||
#pragma clang diagnostic pop
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init);
|
|||
return (id)kCFNull; // Nothing to export
|
||||
}
|
||||
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, [NSString stringWithFormat:@"[RCTModuleData config] %@", _moduleClass], nil);
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, ([NSString stringWithFormat:@"[RCTModuleData config] %@", _moduleClass]), nil);
|
||||
|
||||
NSMutableArray<NSString *> *methods = self.methods.count ? [NSMutableArray new] : nil;
|
||||
NSMutableArray<NSNumber *> *promiseMethods = nil;
|
||||
|
@ -335,7 +335,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init);
|
|||
RCTNullIfNil(promiseMethods),
|
||||
RCTNullIfNil(syncMethods)
|
||||
];
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, ([NSString stringWithFormat:@"[RCTModuleData config] %@", _moduleClass]), nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, ([NSString stringWithFormat:@"[RCTModuleData config] %@", _moduleClass]));
|
||||
return config;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#import "RCTLog.h"
|
||||
#import "RCTParserUtils.h"
|
||||
#import "RCTUtils.h"
|
||||
#import "RCTProfile.h"
|
||||
|
||||
typedef BOOL (^RCTArgumentBlock)(RCTBridge *, NSUInteger, id);
|
||||
|
||||
|
@ -399,7 +400,10 @@ SEL RCTParseMethodSignature(NSString *methodSignature, NSArray<RCTMethodArgument
|
|||
- (SEL)selector
|
||||
{
|
||||
if (_selector == NULL) {
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"", (@{ @"module": NSStringFromClass(_moduleClass),
|
||||
@"method": _methodSignature }));
|
||||
[self processMethodSignature];
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
}
|
||||
return _selector;
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
#if RCT_PROFILE
|
||||
if (RCTProfileIsProfiling()) {
|
||||
NSString *label =_labelsForTags[tag];
|
||||
RCTProfileEndAsyncEvent(RCTProfileTagAlways, @"native", _cookies[tag], label, @"RCTPerformanceLogger", nil);
|
||||
RCTProfileEndAsyncEvent(RCTProfileTagAlways, @"native", _cookies[tag], label, @"RCTPerformanceLogger");
|
||||
}
|
||||
#endif
|
||||
if (_data[tag][0] != 0 && _data[tag][1] == 0) {
|
||||
|
|
|
@ -99,7 +99,7 @@ NSString *const RCTContentDidAppearNotification = @"RCTContentDidAppearNotificat
|
|||
[self showLoadingView];
|
||||
}
|
||||
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -314,7 +314,7 @@ static NSThread *newJavaScriptThread(void)
|
|||
_javaScriptThread = newJavaScriptThread();
|
||||
}
|
||||
|
||||
RCT_PROFILE_END_EVENT(0, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -429,10 +429,10 @@ static NSThread *newJavaScriptThread(void)
|
|||
return nil;
|
||||
}
|
||||
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"nativeRequireModuleConfig", nil);
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"nativeRequireModuleConfig", @{ @"moduleName": moduleName });
|
||||
NSArray *config = [strongSelf->_bridge configForModuleName:moduleName];
|
||||
NSString *result = config ? RCTJSONStringify(config, NULL) : nil;
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"js_call,config", @{ @"moduleName": moduleName });
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"js_call,config");
|
||||
return result;
|
||||
};
|
||||
|
||||
|
@ -444,7 +444,7 @@ static NSThread *newJavaScriptThread(void)
|
|||
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"nativeFlushQueueImmediate", nil);
|
||||
[strongSelf->_bridge handleBuffer:calls batchEnded:NO];
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"js_call", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"js_call");
|
||||
};
|
||||
|
||||
context[@"nativeCallSyncHook"] = ^id(NSUInteger module, NSUInteger method, NSArray *args) {
|
||||
|
@ -455,7 +455,7 @@ static NSThread *newJavaScriptThread(void)
|
|||
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"nativeCallSyncHook", nil);
|
||||
id result = [strongSelf->_bridge callNativeModule:module method:method params:args];
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"js_call,config", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"js_call,config");
|
||||
return result;
|
||||
};
|
||||
|
||||
|
@ -543,7 +543,7 @@ static void installBasicSynchronousHooksOnContext(JSContext *context)
|
|||
RCT_PROFILE_BEGIN_EVENT(tag.longLongValue, profileName, args);
|
||||
};
|
||||
context[@"nativeTraceEndSection"] = ^(NSNumber *tag) {
|
||||
RCT_PROFILE_END_EVENT(tag.longLongValue, @"console", nil);
|
||||
RCT_PROFILE_END_EVENT(tag.longLongValue, @"console");
|
||||
};
|
||||
RCTCookieMap *cookieMap = [RCTCookieMap new];
|
||||
context[@"nativeTraceBeginAsyncSection"] = ^(uint64_t tag, NSString *name, NSUInteger cookie) {
|
||||
|
@ -557,7 +557,7 @@ static void installBasicSynchronousHooksOnContext(JSContext *context)
|
|||
newCookie = it->second;
|
||||
cookieMap->_cookieMap.erase(it);
|
||||
}
|
||||
RCTProfileEndAsyncEvent(tag, @"js,async", newCookie, name, @"JS async", nil);
|
||||
RCTProfileEndAsyncEvent(tag, @"js,async", newCookie, name, @"JS async");
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
@ -654,7 +654,7 @@ static void installBasicSynchronousHooksOnContext(JSContext *context)
|
|||
return;
|
||||
}
|
||||
|
||||
RCT_PROFILE_BEGIN_EVENT(0, @"executeJSCall", @{@"method": method, @"args": arguments});
|
||||
RCT_PROFILE_BEGIN_EVENT(0, @"executeJSCall", (@{@"method": method, @"args": arguments}));
|
||||
|
||||
RCTJSCWrapper *jscWrapper = strongSelf->_jscWrapper;
|
||||
JSContext *context = strongSelf->_context.context;
|
||||
|
@ -711,7 +711,7 @@ static void installBasicSynchronousHooksOnContext(JSContext *context)
|
|||
}
|
||||
}
|
||||
|
||||
RCT_PROFILE_END_EVENT(0, @"js_call", nil);
|
||||
RCT_PROFILE_END_EVENT(0, @"js_call");
|
||||
|
||||
onComplete(objcValue, error);
|
||||
}];
|
||||
|
@ -785,7 +785,7 @@ static NSData *loadPossiblyBundledApplicationScript(NSData *script, NSURL *sourc
|
|||
script = nullTerminatedScript;
|
||||
}
|
||||
|
||||
RCT_PROFILE_END_EVENT(0, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
return script;
|
||||
}
|
||||
|
||||
|
@ -798,8 +798,9 @@ static void registerNativeRequire(JSContext *context, RCTJSCExecutor *executor)
|
|||
static NSError *executeApplicationScript(NSData *script, NSURL *sourceURL, RCTJSCWrapper *jscWrapper,
|
||||
RCTPerformanceLogger *performanceLogger, JSGlobalContextRef ctx)
|
||||
{
|
||||
RCT_PROFILE_BEGIN_EVENT(0, @"executeApplicationScript / execute script",
|
||||
@{ @"url": sourceURL.absoluteString, @"size": @(script.length) });
|
||||
RCT_PROFILE_BEGIN_EVENT(0, @"executeApplicationScript / execute script", (@{
|
||||
@"url": sourceURL.absoluteString, @"size": @(script.length)
|
||||
}));
|
||||
[performanceLogger markStartForTag:RCTPLScriptExecution];
|
||||
JSValueRef jsError = NULL;
|
||||
JSStringRef execJSString = jscWrapper->JSStringCreateWithUTF8CString((const char *)script.bytes);
|
||||
|
@ -809,7 +810,7 @@ static NSError *executeApplicationScript(NSData *script, NSURL *sourceURL, RCTJS
|
|||
jscWrapper->JSStringRelease(execJSString);
|
||||
[performanceLogger markStopForTag:RCTPLScriptExecution];
|
||||
NSError *error = result ? nil : RCTNSErrorFromJSError(jscWrapper, ctx, jsError);
|
||||
RCT_PROFILE_END_EVENT(0, @"js_call", nil);
|
||||
RCT_PROFILE_END_EVENT(0, @"js_call");
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -872,7 +873,7 @@ static NSError *executeApplicationScript(NSData *script, NSURL *sourceURL, RCTJS
|
|||
error = RCTNSErrorFromJSError(jscWrapper, ctx, jsError);
|
||||
}
|
||||
}
|
||||
RCT_PROFILE_END_EVENT(0, @"js_call,json_call", nil);
|
||||
RCT_PROFILE_END_EVENT(0, @"js_call,json_call");
|
||||
|
||||
if (onComplete) {
|
||||
onComplete(error);
|
||||
|
@ -923,8 +924,7 @@ static void executeRandomAccessModule(RCTJSCExecutor *executor, uint32_t moduleI
|
|||
|
||||
[_performanceLogger addValue:1 forTag:RCTPLRAMNativeRequiresCount];
|
||||
[_performanceLogger appendStartForTag:RCTPLRAMNativeRequires];
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways,
|
||||
[@"nativeRequire_" stringByAppendingFormat:@"%@", moduleID], nil);
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, ([@"nativeRequire_" stringByAppendingFormat:@"%@", moduleID]), nil);
|
||||
|
||||
const uint32_t ID = [moduleID unsignedIntValue];
|
||||
|
||||
|
@ -941,7 +941,7 @@ static void executeRandomAccessModule(RCTJSCExecutor *executor, uint32_t moduleI
|
|||
executeRandomAccessModule(self, ID, NSSwapLittleIntToHost(moduleData->offset), size);
|
||||
}
|
||||
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"js_call", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"js_call");
|
||||
[_performanceLogger appendStopForTag:RCTPLRAMNativeRequires];
|
||||
}
|
||||
|
||||
|
|
|
@ -278,7 +278,7 @@ RCT_EXPORT_MODULE()
|
|||
self->_bridge = nil;
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1150,7 +1150,9 @@ RCT_EXPORT_METHOD(dispatchViewManagerCommand:(nonnull NSNumber *)reactTag
|
|||
RCTProfileBeginFlowEvent();
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
RCTProfileEndFlowEvent();
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"-[UIManager flushUIBlocks]", nil);
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"-[UIManager flushUIBlocks]", (@{
|
||||
@"count": @(previousPendingUIBlocks.count),
|
||||
}));
|
||||
@try {
|
||||
for (RCTViewManagerUIBlock block in previousPendingUIBlocks) {
|
||||
block(self, self->_viewRegistry);
|
||||
|
@ -1159,9 +1161,6 @@ RCT_EXPORT_METHOD(dispatchViewManagerCommand:(nonnull NSNumber *)reactTag
|
|||
@catch (NSException *exception) {
|
||||
RCTLogError(@"Exception thrown while executing UI block: %@", exception);
|
||||
}
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"objc_call", @{
|
||||
@"count": @(previousPendingUIBlocks.count),
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,12 +69,12 @@ RCT_EXTERN void _RCTProfileBeginEvent(NSThread *calleeThread,
|
|||
uint64_t tag,
|
||||
NSString *name,
|
||||
NSDictionary *args);
|
||||
#define RCT_PROFILE_BEGIN_EVENT(...) \
|
||||
#define RCT_PROFILE_BEGIN_EVENT(tag, name, args) \
|
||||
do { \
|
||||
if (RCTProfileIsProfiling()) { \
|
||||
NSThread *__calleeThread = [NSThread currentThread]; \
|
||||
NSTimeInterval __time = CACurrentMediaTime(); \
|
||||
_RCTProfileBeginEvent(__calleeThread, __time, __VA_ARGS__); \
|
||||
_RCTProfileBeginEvent(__calleeThread, __time, tag, name, args); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
|
@ -87,16 +87,15 @@ RCT_EXTERN void _RCTProfileEndEvent(NSThread *calleeThread,
|
|||
NSString *threadName,
|
||||
NSTimeInterval time,
|
||||
uint64_t tag,
|
||||
NSString *category,
|
||||
NSDictionary *args);
|
||||
NSString *category);
|
||||
|
||||
#define RCT_PROFILE_END_EVENT(...) \
|
||||
#define RCT_PROFILE_END_EVENT(tag, category) \
|
||||
do { \
|
||||
if (RCTProfileIsProfiling()) { \
|
||||
NSThread *__calleeThread = [NSThread currentThread]; \
|
||||
NSString *__threadName = RCTCurrentThreadName(); \
|
||||
NSTimeInterval __time = CACurrentMediaTime(); \
|
||||
_RCTProfileEndEvent(__calleeThread, __threadName, __time, __VA_ARGS__); \
|
||||
_RCTProfileEndEvent(__calleeThread, __threadName, __time, tag, category); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
|
@ -116,8 +115,7 @@ RCT_EXTERN void RCTProfileEndAsyncEvent(uint64_t tag,
|
|||
NSString *category,
|
||||
NSUInteger cookie,
|
||||
NSString *name,
|
||||
NSString *threadName,
|
||||
NSDictionary *args);
|
||||
NSString *threadName);
|
||||
|
||||
/**
|
||||
* An event that doesn't have a duration (i.e. Notification, VSync, etc)
|
||||
|
|
|
@ -136,22 +136,6 @@ static NSDictionary *RCTProfileGetMemoryUsage(void)
|
|||
}
|
||||
}
|
||||
|
||||
static NSDictionary *RCTProfileMergeArgs(NSDictionary *args0, NSDictionary *args1)
|
||||
{
|
||||
args0 = RCTNilIfNull(args0);
|
||||
args1 = RCTNilIfNull(args1);
|
||||
|
||||
if (!args0 && args1) {
|
||||
args0 = args1;
|
||||
} else if (args0 && args1) {
|
||||
NSMutableDictionary *d = [args0 mutableCopy];
|
||||
[d addEntriesFromDictionary:args1];
|
||||
args0 = [d copy];
|
||||
}
|
||||
|
||||
return RCTNullIfNil(args0);
|
||||
}
|
||||
|
||||
#pragma mark - Module hooks
|
||||
|
||||
static const char *RCTProfileProxyClassName(Class class)
|
||||
|
@ -207,13 +191,13 @@ void RCTProfileTrampolineStart(id self, SEL cmd)
|
|||
* block.
|
||||
*/
|
||||
Class klass = [self class];
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, [NSString stringWithFormat:@"-[%s %s]", class_getName(klass), sel_getName(cmd)], nil);
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, ([NSString stringWithFormat:@"-[%s %s]", class_getName(klass), sel_getName(cmd)]), nil);
|
||||
}
|
||||
|
||||
RCT_EXTERN void RCTProfileTrampolineEnd(void);
|
||||
void RCTProfileTrampolineEnd(void)
|
||||
{
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"objc_call,modules,auto", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"objc_call,modules,auto");
|
||||
}
|
||||
|
||||
static UIView *(*originalCreateView)(RCTComponentData *, SEL, NSNumber *);
|
||||
|
@ -331,7 +315,7 @@ void RCTProfileHookModules(RCTBridge *bridge)
|
|||
} queue:moduleData.methodQueue];
|
||||
}
|
||||
}
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"", nil);
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
|
||||
}
|
||||
|
||||
static void RCTProfileUnhookInstance(id instance)
|
||||
|
@ -569,13 +553,12 @@ void _RCTProfileEndEvent(
|
|||
NSString *threadName,
|
||||
NSTimeInterval time,
|
||||
uint64_t tag,
|
||||
NSString *category,
|
||||
NSDictionary *args
|
||||
NSString *category
|
||||
) {
|
||||
CHECK();
|
||||
|
||||
if (callbacks != NULL) {
|
||||
callbacks->end_section(tag, args.count, RCTProfileSystraceArgsFromNSDictionary(args));
|
||||
callbacks->end_section(tag, 0, nil);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -589,7 +572,6 @@ void _RCTProfileEndEvent(
|
|||
}
|
||||
|
||||
NSNumber *start = event[0];
|
||||
|
||||
RCTProfileAddEvent(RCTProfileTraceEvents,
|
||||
@"tid": threadName,
|
||||
@"name": event[1],
|
||||
|
@ -597,7 +579,7 @@ void _RCTProfileEndEvent(
|
|||
@"ph": @"X",
|
||||
@"ts": start,
|
||||
@"dur": @(RCTProfileTimestamp(time).doubleValue - start.doubleValue),
|
||||
@"args": RCTProfileMergeArgs(event[2], args),
|
||||
@"args": event[2],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@ -634,13 +616,12 @@ void RCTProfileEndAsyncEvent(
|
|||
NSString *category,
|
||||
NSUInteger cookie,
|
||||
NSString *name,
|
||||
NSString *threadName,
|
||||
NSDictionary *args
|
||||
NSString *threadName
|
||||
) {
|
||||
CHECK();
|
||||
|
||||
if (callbacks != NULL) {
|
||||
callbacks->end_async_section(tag, name.UTF8String, (int)(cookie % INT_MAX), args.count, RCTProfileSystraceArgsFromNSDictionary(args));
|
||||
callbacks->end_async_section(tag, name.UTF8String, (int)(cookie % INT_MAX), 0, nil);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -659,7 +640,7 @@ void RCTProfileEndAsyncEvent(
|
|||
@"ph": @"X",
|
||||
@"ts": event[0],
|
||||
@"dur": @(endTimestamp.doubleValue - [event[0] doubleValue]),
|
||||
@"args": RCTProfileMergeArgs(event[2], args),
|
||||
@"args": event[2],
|
||||
);
|
||||
[RCTProfileOngoingEvents removeObjectForKey:@(cookie)];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue