From f9a3ed37939710daeaa90222081c15708f670ff1 Mon Sep 17 00:00:00 2001 From: Aaron Chiu Date: Thu, 2 Mar 2017 15:41:26 -0800 Subject: [PATCH] in non-lazy mode, log instantiation time for each native module Reviewed By: alexeylang Differential Revision: D4640157 fbshipit-source-id: cfc1c3114ef97b8ba12839c3814a72b8ece869d6 --- .../main/java/com/facebook/react/LazyReactPackage.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/LazyReactPackage.java b/ReactAndroid/src/main/java/com/facebook/react/LazyReactPackage.java index 2e53bad4e..3e8532298 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/LazyReactPackage.java +++ b/ReactAndroid/src/main/java/com/facebook/react/LazyReactPackage.java @@ -16,6 +16,8 @@ import java.util.List; import com.facebook.react.bridge.ModuleSpec; import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMarker; +import com.facebook.react.bridge.ReactMarkerConstants; import com.facebook.react.module.model.ReactModuleInfoProvider; import com.facebook.react.uimanager.ViewManager; import com.facebook.systrace.Systrace; @@ -69,14 +71,20 @@ public abstract class LazyReactPackage implements ReactPackage { public final List createNativeModules(ReactApplicationContext reactContext) { List modules = new ArrayList<>(); for (ModuleSpec holder : getNativeModules(reactContext)) { + NativeModule nativeModule; SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "createNativeModule") .arg("module", holder.getType()) .flush(); try { - modules.add(holder.getProvider().get()); + ReactMarker.logMarker( + ReactMarkerConstants.CREATE_MODULE_START, + holder.getType().getSimpleName()); + nativeModule = holder.getProvider().get(); + ReactMarker.logMarker(ReactMarkerConstants.CREATE_MODULE_END); } finally { Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE); } + modules.add(nativeModule); } return modules; }