-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: Assign string label to each case in RCTPLTag enum for start…
…up performance logging Summary: `_labelsForTags` is an array with string labels used only for local profiling, that we had to manually keep it in sync with `RCTPLTag`. Refactor so labels are assigned with switch instead. Changelog: [iOS] Refactor: Assign string label to each case in RCTPLTag enum for startup performance logging Reviewed By: fkgozali Differential Revision: D32889043 fbshipit-source-id: 81da592a160a31b91e78289be0990cc2ff960f29
- Loading branch information
1 parent
d393e94
commit 60e60a9
Showing
9 changed files
with
121 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
typedef NS_ENUM(NSInteger, RCTPLTag) { | ||
RCTPLScriptDownload = 0, | ||
RCTPLScriptExecution, | ||
RCTPLRAMBundleLoad, | ||
RCTPLRAMStartupCodeSize, | ||
RCTPLRAMStartupNativeRequires, | ||
RCTPLRAMStartupNativeRequiresCount, | ||
RCTPLRAMNativeRequires, | ||
RCTPLRAMNativeRequiresCount, | ||
RCTPLNativeModuleInit, | ||
RCTPLNativeModuleMainThread, | ||
RCTPLNativeModulePrepareConfig, | ||
RCTPLNativeModuleMainThreadUsesCount, | ||
RCTPLNativeModuleSetup, | ||
RCTPLTurboModuleSetup, | ||
RCTPLJSCWrapperOpenLibrary, | ||
RCTPLBridgeStartup, | ||
RCTPLTTI, | ||
RCTPLBundleSize, | ||
RCTPLReactInstanceInit, | ||
RCTPLSize // This is used to count the size | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#import <React/RCTDefines.h> | ||
#import "RCTPLTag.h" | ||
|
||
// Return the string label for the enum RCTPLTag for performance logging | ||
__attribute__((used)) RCT_EXTERN NSString *RCTPLLabelForTag(RCTPLTag tag); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#import "RCTPerformanceLoggerLabels.h" | ||
#import <React/RCTAssert.h> | ||
|
||
NSString *RCTPLLabelForTag(RCTPLTag tag) | ||
{ | ||
switch (tag) { | ||
case RCTPLScriptDownload: | ||
return @"ScriptDownload"; | ||
case RCTPLScriptExecution: | ||
return @"ScriptExecution"; | ||
case RCTPLRAMBundleLoad: | ||
return @"RAMBundleLoad"; | ||
case RCTPLRAMStartupCodeSize: | ||
return @"RAMStartupCodeSize"; | ||
case RCTPLRAMStartupNativeRequires: | ||
return @"RAMStartupNativeRequires"; | ||
case RCTPLRAMStartupNativeRequiresCount: | ||
return @"RAMStartupNativeRequiresCount"; | ||
case RCTPLRAMNativeRequires: | ||
return @"RAMNativeRequires"; | ||
case RCTPLRAMNativeRequiresCount: | ||
return @"RAMNativeRequiresCount"; | ||
case RCTPLNativeModuleInit: | ||
return @"NativeModuleInit"; | ||
case RCTPLNativeModuleMainThread: | ||
return @"NativeModuleMainThread"; | ||
case RCTPLNativeModulePrepareConfig: | ||
return @"NativeModulePrepareConfig"; | ||
case RCTPLNativeModuleMainThreadUsesCount: | ||
return @"NativeModuleMainThreadUsesCount"; | ||
case RCTPLNativeModuleSetup: | ||
return @"NativeModuleSetup"; | ||
case RCTPLTurboModuleSetup: | ||
return @"TurboModuleSetup"; | ||
case RCTPLJSCWrapperOpenLibrary: | ||
return @"JSCWrapperOpenLibrary"; | ||
case RCTPLBridgeStartup: | ||
return @"BridgeStartup"; | ||
case RCTPLTTI: | ||
return @"RootViewTTI"; | ||
case RCTPLBundleSize: | ||
return @"BundleSize"; | ||
case RCTPLReactInstanceInit: | ||
return @"ReactInstanceInit"; | ||
case RCTPLSize: // Only used to count enum size | ||
RCTAssert(NO, @"RCTPLSize should not be used to track performance timestamps."); | ||
return nil; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters