From 4b19db31591ae52938eefcd5fe3cd9d622be3021 Mon Sep 17 00:00:00 2001 From: Siqi Liu Date: Tue, 7 Jun 2016 09:43:33 -0700 Subject: [PATCH] Remove the Profiler Option in RN Android Dev Menu Summary: Remove the "Start/Stop" option in RN Android dev menu. mkonicek talked to Mike Armstrong who originally added this option and he said Traceview didn't end up being used much and Systrace was the preferred way to do profiling, which is used from the command line. Haven't removed all the codes behind because there are some codes in JNI, including native methods in C++ through the ReactBridge. Dev menu before: {F61306550} Dev menu after: {F61306553} Reviewed By: mkonicek Differential Revision: D3391092 fbshipit-source-id: c400d8bb3c196afa9ef53cda13476e1fec6c2384 --- .../devsupport/DevSupportManagerImpl.java | 51 ------------------- .../main/res/devsupport/values/strings.xml | 2 - 2 files changed, 53 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerImpl.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerImpl.java index 35d7471fef..21a025c573 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerImpl.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerImpl.java @@ -87,9 +87,6 @@ public class DevSupportManagerImpl implements DevSupportManager { private static final String EXOPACKAGE_LOCATION_FORMAT = "/data/local/tmp/exopackage/%s//secondary-dex"; - private static final int JAVA_SAMPLING_PROFILE_MEMORY_BYTES = 8 * 1024 * 1024; - private static final int JAVA_SAMPLING_PROFILE_DELTA_US = 100; - private final Context mApplicationContext; private final ShakeDetector mShakeDetector; private final BroadcastReceiver mReloadAppBroadcastReceiver; @@ -109,8 +106,6 @@ public class DevSupportManagerImpl implements DevSupportManager { private boolean mIsReceiverRegistered = false; private boolean mIsShakeDetectorStarted = false; private boolean mIsDevSupportEnabled = false; - private boolean mIsCurrentlyProfiling = false; - private int mProfileIndex = 0; private @Nullable RedBoxHandler mRedBoxHandler; public DevSupportManagerImpl( @@ -355,42 +350,6 @@ public class DevSupportManagerImpl implements DevSupportManager { } } }); - if (mCurrentContext != null && - mCurrentContext.getCatalystInstance() != null && - !mCurrentContext.getCatalystInstance().isDestroyed() && - mCurrentContext.getCatalystInstance().supportsProfiling()) { - options.put( - mApplicationContext.getString( - mIsCurrentlyProfiling ? R.string.catalyst_stop_profile : - R.string.catalyst_start_profile), - new DevOptionHandler() { - @Override - public void onOptionSelected() { - if (mCurrentContext != null && mCurrentContext.hasActiveCatalystInstance()) { - String profileName = (Environment.getExternalStorageDirectory().getPath() + - "/profile_" + mProfileIndex + ".json"); - if (mIsCurrentlyProfiling) { - mIsCurrentlyProfiling = false; - mProfileIndex++; - Debug.stopMethodTracing(); - mCurrentContext.getCatalystInstance() - .stopProfiler("profile", profileName); - Toast.makeText( - mCurrentContext, - "Profile output to " + profileName, - Toast.LENGTH_LONG).show(); - } else { - mIsCurrentlyProfiling = true; - mCurrentContext.getCatalystInstance().startProfiler("profile"); - Debug.startMethodTracingSampling( - profileName, - JAVA_SAMPLING_PROFILE_MEMORY_BYTES, - JAVA_SAMPLING_PROFILE_DELTA_US); - } - } - } - }); - } options.put( mApplicationContext.getString(R.string.catalyst_settings), new DevOptionHandler() { @Override @@ -550,16 +509,6 @@ public class DevSupportManagerImpl implements DevSupportManager { return; } - // if currently profiling stop and write the profile file - if (mIsCurrentlyProfiling) { - mIsCurrentlyProfiling = false; - String profileName = (Environment.getExternalStorageDirectory().getPath() + - "/profile_" + mProfileIndex + ".json"); - mProfileIndex++; - Debug.stopMethodTracing(); - mCurrentContext.getCatalystInstance().stopProfiler("profile", profileName); - } - mCurrentContext = reactContext; // Recreate debug overlay controller with new CatalystInstance object diff --git a/ReactAndroid/src/main/res/devsupport/values/strings.xml b/ReactAndroid/src/main/res/devsupport/values/strings.xml index edf2669c1c..fc84ce1d28 100644 --- a/ReactAndroid/src/main/res/devsupport/values/strings.xml +++ b/ReactAndroid/src/main/res/devsupport/values/strings.xml @@ -17,7 +17,5 @@ Connecting to remote debugger Unable to connect with remote debugger Toggle Inspector - Start Profile - Stop Profile Capture Heap