mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-09 22:43:10 +08:00
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
This commit is contained in:
committed by
Facebook Github Bot 7
parent
7e7abff55a
commit
4b19db3159
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user