mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Refactor startup performance API implementation
Summary: Refactor the startup performance API so that we are not using a vector to store only a few startup metrics values. This makes the metrics more strictly typed and concise. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D43860049 fbshipit-source-id: 2c2102de2b64e2c5cda509ac26f0d1d072287083
This commit is contained in:
committed by
Facebook GitHub Bot
parent
bcec590071
commit
0018a695da
@@ -58,26 +58,15 @@ std::unordered_map<std::string, double> NativePerformance::getSimpleMemoryInfo(
|
||||
ReactNativeStartupTiming NativePerformance::getReactNativeStartupTiming(
|
||||
jsi::Runtime &rt) {
|
||||
ReactNativeStartupTiming result = {0, 0, 0, 0};
|
||||
result.startTime = ReactMarker::getAppStartTime();
|
||||
|
||||
auto startupReactMarkers =
|
||||
ReactMarker::StartupLogger::getInstance().getStartupReactMarkers();
|
||||
for (const auto &startupReactMarker : startupReactMarkers) {
|
||||
auto time = startupReactMarker.time;
|
||||
switch (startupReactMarker.markerId) {
|
||||
case ReactMarker::ReactMarkerId::RUN_JS_BUNDLE_START:
|
||||
result.executeJavaScriptBundleEntryPointStart = time;
|
||||
break;
|
||||
|
||||
case ReactMarker::ReactMarkerId::RUN_JS_BUNDLE_STOP:
|
||||
result.executeJavaScriptBundleEntryPointEnd = time;
|
||||
result.endTime = time;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
ReactMarker::StartupLogger &startupLogger =
|
||||
ReactMarker::StartupLogger::getInstance();
|
||||
result.startTime = startupLogger.getAppStartTime();
|
||||
result.executeJavaScriptBundleEntryPointStart =
|
||||
startupLogger.getRunJSBundleStartTime();
|
||||
result.executeJavaScriptBundleEntryPointEnd =
|
||||
startupLogger.getRunJSBundleEndTime();
|
||||
result.endTime = startupLogger.getRunJSBundleEndTime();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user