Skip to content
Permalink
Browse files

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
  • Loading branch information
Siqi Liu Facebook Github Bot 7
Siqi Liu authored and Facebook Github Bot 7 committed Jun 7, 2016
1 parent 7e7abff commit 4b19db31591ae52938eefcd5fe3cd9d622be3021
@@ -87,9 +87,6 @@
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 @@
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 void onOptionSelected() {
}
}
});
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 @@ private void resetCurrentContext(@Nullable ReactContext reactContext) {
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
@@ -17,7 +17,5 @@
<string name="catalyst_remotedbg_message" project="catalyst" translatable="false">Connecting to remote debugger</string>
<string name="catalyst_remotedbg_error" project="catalyst" translatable="false">Unable to connect with remote debugger</string>
<string name="catalyst_element_inspector" project="catalyst" translatable="false">Toggle Inspector</string>
<string name="catalyst_start_profile" project="catalyst" translatable="false">Start Profile</string>
<string name="catalyst_stop_profile" project="catalyst" translatable="false">Stop Profile</string>
<string name="catalyst_heap_capture" project="catalyst" translatable="false">Capture Heap</string>
</resources>

0 comments on commit 4b19db3

Please sign in to comment.
You can’t perform that action at this time.