Add js1 perf cpuprofile command
Reviewed By: cwdick Differential Revision: D4397944 fbshipit-source-id: a4255e766044f6cf6c2ea8a8364542574cd9314b
This commit is contained in:
parent
a0dd54b4d7
commit
e94beab4c7
|
@ -84,6 +84,7 @@ public class DevServerHelper {
|
|||
public interface PackagerCommandListener {
|
||||
void onPackagerReloadCommand();
|
||||
void onCaptureHeapCommand();
|
||||
void onPokeSamplingProfilerCommand();
|
||||
}
|
||||
|
||||
public interface PackagerStatusCallback {
|
||||
|
@ -129,6 +130,8 @@ public class DevServerHelper {
|
|||
commandListener.onPackagerReloadCommand();
|
||||
} else if ("captureHeap".equals(action)) {
|
||||
commandListener.onCaptureHeapCommand();
|
||||
} else if ("pokeSamplingProfiler".equals(action)) {
|
||||
commandListener.onPokeSamplingProfilerCommand();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -425,24 +425,7 @@ public class DevSupportManagerImpl implements DevSupportManager, PackagerCommand
|
|||
new DevOptionHandler() {
|
||||
@Override
|
||||
public void onOptionSelected() {
|
||||
try {
|
||||
List<String> pokeResults = JSCSamplingProfiler.poke(60000);
|
||||
for (String result : pokeResults) {
|
||||
Toast.makeText(
|
||||
mCurrentContext,
|
||||
result == null
|
||||
? "Started JSC Sampling Profiler"
|
||||
: "Stopped JSC Sampling Profiler",
|
||||
Toast.LENGTH_LONG).show();
|
||||
if (result != null) {
|
||||
new JscProfileTask(getSourceUrl()).executeOnExecutor(
|
||||
AsyncTask.THREAD_POOL_EXECUTOR,
|
||||
result);
|
||||
}
|
||||
}
|
||||
} catch (JSCSamplingProfiler.ProfilerException e) {
|
||||
showNewJavaError(e.getMessage(), e);
|
||||
}
|
||||
handlePokeSamplingProfiler();
|
||||
}
|
||||
});
|
||||
options.put(
|
||||
|
@ -699,12 +682,43 @@ public class DevSupportManagerImpl implements DevSupportManager, PackagerCommand
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPokeSamplingProfilerCommand() {
|
||||
UiThreadUtil.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
handlePokeSamplingProfiler();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void handleCaptureHeap() {
|
||||
JSCHeapCapture.captureHeap(
|
||||
mApplicationContext.getCacheDir().getPath(),
|
||||
JSCHeapUpload.captureCallback(mDevServerHelper.getHeapCaptureUploadUrl()));
|
||||
}
|
||||
|
||||
private void handlePokeSamplingProfiler() {
|
||||
try {
|
||||
List<String> pokeResults = JSCSamplingProfiler.poke(60000);
|
||||
for (String result : pokeResults) {
|
||||
Toast.makeText(
|
||||
mCurrentContext,
|
||||
result == null
|
||||
? "Started JSC Sampling Profiler"
|
||||
: "Stopped JSC Sampling Profiler",
|
||||
Toast.LENGTH_LONG).show();
|
||||
if (result != null) {
|
||||
new JscProfileTask(getSourceUrl()).executeOnExecutor(
|
||||
AsyncTask.THREAD_POOL_EXECUTOR,
|
||||
result);
|
||||
}
|
||||
}
|
||||
} catch (JSCSamplingProfiler.ProfilerException e) {
|
||||
showNewJavaError(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateLastErrorInfo(
|
||||
final String message,
|
||||
final StackFrame[] stack,
|
||||
|
|
Loading…
Reference in New Issue