Add more systrace to RN startup

Summary:
Added systrace to the following sections
1. When Marketplace Home Fragment is created
2. On initialization of Catalyst Instance

Reviewed By: achen1

Differential Revision: D9665376

fbshipit-source-id: e48e9f50dad42c71fb2151538f65bc54939adc1e
This commit is contained in:
Ram N 2018-09-05 20:56:32 -07:00 committed by Facebook Github Bot
parent d838b6c550
commit b1d205a28f
2 changed files with 12 additions and 1 deletions

View File

@ -1128,9 +1128,13 @@ public class ReactInstanceManager {
catalystInstance.setGlobalVariable("__RCTProfileIsProfiling", "true");
}
ReactMarker.logMarker(ReactMarkerConstants.PRE_RUN_JS_BUNDLE_START);
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "runJSBundle");
catalystInstance.runJSBundle();
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
reactContext.initializeWithInstance(catalystInstance);
return reactContext;
}
@ -1190,6 +1194,6 @@ public class ReactInstanceManager {
if (reactPackage instanceof ReactPackageLogger) {
((ReactPackageLogger) reactPackage).endProcessPackage();
}
SystraceMessage.endSection(TRACE_TAG_REACT_JAVA_BRIDGE).flush();
SystraceMessage.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
}
}

View File

@ -7,6 +7,8 @@
package com.facebook.react.bridge;
import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
import android.content.res.AssetManager;
import android.os.AsyncTask;
import android.util.Log;
@ -103,6 +105,8 @@ public class CatalystInstanceImpl implements CatalystInstance {
final JSBundleLoader jsBundleLoader,
NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler) {
Log.d(ReactConstants.TAG, "Initializing React Xplat Bridge.");
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "createCatalystInstanceImpl");
mHybridData = initHybrid();
mReactQueueConfiguration = ReactQueueConfigurationImpl.create(
@ -115,8 +119,10 @@ public class CatalystInstanceImpl implements CatalystInstance {
mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler;
mNativeModulesQueueThread = mReactQueueConfiguration.getNativeModulesQueueThread();
mTraceListener = new JSProfilerTraceListener(this);
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
Log.d(ReactConstants.TAG, "Initializing React Xplat Bridge before initializeBridge");
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "initializeCxxBridge");
initializeBridge(
new BridgeCallback(this),
jsExecutor,
@ -125,6 +131,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
mNativeModuleRegistry.getJavaModules(this),
mNativeModuleRegistry.getCxxModules());
Log.d(ReactConstants.TAG, "Initializing React Xplat Bridge after initializeBridge");
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
mJavaScriptContextHolder = new JavaScriptContextHolder(getJavaScriptContext());
}