diff --git a/React/Base/RCTBatchedBridge.m b/React/Base/RCTBatchedBridge.m index c85011c55..4e292de64 100644 --- a/React/Base/RCTBatchedBridge.m +++ b/React/Base/RCTBatchedBridge.m @@ -364,6 +364,7 @@ RCT_EXTERN NSArray *RCTGetModuleClasses(void); // 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 @@ RCT_EXTERN NSArray *RCTGetModuleClasses(void); 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 @@ RCT_EXTERN NSArray *RCTGetModuleClasses(void); RCTPerformanceLoggerAppendEnd(RCTPLNativeModuleMainThread); } }); + modulesOnMainThreadCount++; } } RCTPerformanceLoggerEnd(RCTPLNativeModuleInit); + RCTPerformanceLoggerSet(RCTPLNativeModuleMainThreadUsesCount, modulesOnMainThreadCount); } - (void)setUpExecutor diff --git a/React/Base/RCTPerformanceLogger.h b/React/Base/RCTPerformanceLogger.h index c8978071c..c50e9f9cf 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 7bca4a728..9fc9647c8 100644 --- a/React/Base/RCTPerformanceLogger.m +++ b/React/Base/RCTPerformanceLogger.m @@ -78,6 +78,8 @@ NSArray *RCTPerformanceLoggerOutput(void) @(RCTPLData[RCTPLNativeModulePrepareConfig][1]), @(RCTPLData[RCTPLNativeModuleInjectConfig][0]), @(RCTPLData[RCTPLNativeModuleInjectConfig][1]), + @(RCTPLData[RCTPLNativeModuleMainThreadUsesCount][0]), + @(RCTPLData[RCTPLNativeModuleMainThreadUsesCount][1]), @(RCTPLData[RCTPLJSCExecutorSetup][0]), @(RCTPLData[RCTPLJSCExecutorSetup][1]), @(RCTPLData[RCTPLTTI][0]),