From d3b8846400743f6161b86cc42ead9b81a74e1c9b Mon Sep 17 00:00:00 2001 From: Andy Street Date: Wed, 30 Mar 2016 12:52:25 -0700 Subject: [PATCH] Easy: Add Java module and method name to systrace in xplat bridge Summary: We lost java module and method names in systrace when we moved to the xplat bridge. Reviewed By: mhorowitz Differential Revision: D3116042 fb-gh-sync-id: a61181f4d6be04c70122b7f79d426e364df1e988 fbshipit-source-id: a61181f4d6be04c70122b7f79d426e364df1e988 --- .../java/com/facebook/react/bridge/BaseJavaModule.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/BaseJavaModule.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/BaseJavaModule.java index fc0c0b285..486fbf284 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/BaseJavaModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/BaseJavaModule.java @@ -11,6 +11,7 @@ package com.facebook.react.bridge; import com.facebook.infer.annotation.Assertions; import com.facebook.systrace.Systrace; +import com.facebook.systrace.SystraceMessage; import javax.annotation.Nullable; @@ -160,6 +161,7 @@ public abstract class BaseJavaModule implements NativeModule { private final Object[] mArguments; private String mType = METHOD_TYPE_REMOTE; private final int mJSArgumentsNeeded; + private final String mTraceName; public JavaMethod(Method method) { mMethod = method; @@ -169,6 +171,7 @@ public abstract class BaseJavaModule implements NativeModule { // save to allocate only one arguments object per method that can be reused across calls mArguments = new Object[parameterTypes.length]; mJSArgumentsNeeded = calculateJSArgumentsNeeded(); + mTraceName = BaseJavaModule.this.getName() + "." + mMethod.getName(); } private ArgumentExtractor[] buildArgumentExtractors(Class[] paramTypes) { @@ -231,7 +234,9 @@ public abstract class BaseJavaModule implements NativeModule { @Override public void invoke(CatalystInstance catalystInstance, ExecutorToken executorToken, ReadableNativeArray parameters) { - Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "callJavaModuleMethod"); + SystraceMessage.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "callJavaModuleMethod") + .arg("method", mTraceName) + .flush(); try { if (mJSArgumentsNeeded != parameters.size()) { throw new NativeArgumentsParseException(