timer markings from JS JNI

Differential Revision: D2545138

fb-gh-sync-id: f93670ad929dbe37d641968e506108c6aac0cac2
This commit is contained in:
Mike Armstrong
2015-10-15 05:50:44 -07:00
committed by facebook-github-bot-7
parent 8ddd3e864e
commit 4ec5161685
3 changed files with 49 additions and 0 deletions

View File

@@ -84,6 +84,8 @@ public class NativeModuleRegistry {
/* package */ void notifyCatalystInstanceInitialized() {
UiThreadUtil.assertOnUiThread();
ReactMarker.logMarker("NativeModule_start");
Systrace.beginSection(
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
"NativeModuleRegistry_notifyCatalystInstanceInitialized");
@@ -93,6 +95,7 @@ public class NativeModuleRegistry {
}
} finally {
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
ReactMarker.logMarker("NativeModule_end");
}
}

View File

@@ -0,0 +1,30 @@
// Copyright 2004-present Facebook. All Rights Reserved.
package com.facebook.react.bridge;
import javax.annotation.Nullable;
import com.facebook.proguard.annotations.DoNotStrip;
/**
* Static class that allows markers to be placed in React code and responded to in a
* configurable way
*/
public class ReactMarker {
public interface MarkerListener {
void logMarker(String name);
};
@Nullable static private MarkerListener sMarkerListener = null;
static public void setMarkerListener(MarkerListener listener) {
sMarkerListener = listener;
}
@DoNotStrip
static public void logMarker(String name) {
if (sMarkerListener != null) {
sMarkerListener.logMarker(name);
}
}
}