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:
Siqi Liu 2016-06-07 09:43:33 -07:00 коммит произвёл Facebook Github Bot 7
Родитель 7e7abff55a
Коммит 4b19db3159
2 изменённых файлов: 0 добавлений и 53 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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>