diff --git a/React/Base/RCTBatchedBridge.m b/React/Base/RCTBatchedBridge.m index c85011c556f86b..4e292de64c3869 100644 --- a/React/Base/RCTBatchedBridge.m +++ b/React/Base/RCTBatchedBridge.m @@ -364,6 +364,7 @@ - (void)initModulesWithDispatchGroup:(dispatch_group_t)dispatchGroup // Set up modules that require main thread init or constants export RCTPerformanceLoggerSet(RCTPLNativeModuleMainThread, 0); + NSUInteger modulesOnMainThreadCount = 0; for (RCTModuleData *moduleData in _moduleDataByID) { __weak RCTBatchedBridge *weakSelf = self; if (moduleData.requiresMainThreadSetup) { @@ -380,6 +381,7 @@ - (void)initModulesWithDispatchGroup:(dispatch_group_t)dispatchGroup RCTPerformanceLoggerAppendEnd(RCTPLNativeModuleMainThread); } }); + modulesOnMainThreadCount++; } else if (moduleData.hasConstantsToExport) { // Constants must be exported on the main thread, but module setup can // be done on any queue @@ -391,10 +393,12 @@ - (void)initModulesWithDispatchGroup:(dispatch_group_t)dispatchGroup RCTPerformanceLoggerAppendEnd(RCTPLNativeModuleMainThread); } }); + modulesOnMainThreadCount++; } } RCTPerformanceLoggerEnd(RCTPLNativeModuleInit); + RCTPerformanceLoggerSet(RCTPLNativeModuleMainThreadUsesCount, modulesOnMainThreadCount); } - (void)setUpExecutor diff --git a/React/Base/RCTPerformanceLogger.h b/React/Base/RCTPerformanceLogger.h index c8978071cff881..c50e9f9cf54eb5 100644 --- a/React/Base/RCTPerformanceLogger.h +++ b/React/Base/RCTPerformanceLogger.h @@ -18,6 +18,7 @@ typedef NS_ENUM(NSUInteger, RCTPLTag) { RCTPLNativeModuleMainThread, RCTPLNativeModulePrepareConfig, RCTPLNativeModuleInjectConfig, + RCTPLNativeModuleMainThreadUsesCount, RCTPLJSCExecutorSetup, RCTPLTTI, RCTPLBundleSize, diff --git a/React/Base/RCTPerformanceLogger.m b/React/Base/RCTPerformanceLogger.m index 7bca4a728c680d..9fc9647c89e3e5 100644 --- a/React/Base/RCTPerformanceLogger.m +++ b/React/Base/RCTPerformanceLogger.m @@ -78,6 +78,8 @@ void RCTPerformanceLoggerAppendEnd(RCTPLTag tag) @(RCTPLData[RCTPLNativeModulePrepareConfig][1]), @(RCTPLData[RCTPLNativeModuleInjectConfig][0]), @(RCTPLData[RCTPLNativeModuleInjectConfig][1]), + @(RCTPLData[RCTPLNativeModuleMainThreadUsesCount][0]), + @(RCTPLData[RCTPLNativeModuleMainThreadUsesCount][1]), @(RCTPLData[RCTPLJSCExecutorSetup][0]), @(RCTPLData[RCTPLJSCExecutorSetup][1]), @(RCTPLData[RCTPLTTI][0]),