add perf markers for reload and download

Reviewed By: alexeylang

Differential Revision: D5633613

fbshipit-source-id: 1fe39669cf4ba4e1475bb57de59c696771ebf8c7
This commit is contained in:
Ben Nham 2017-08-17 05:26:38 -07:00 committed by Facebook Github Bot
parent 30d9c3d279
commit c080fe54d6
4 changed files with 13 additions and 3 deletions

View File

@ -67,4 +67,7 @@ public enum ReactMarkerConstants {
ATTACH_MEASURED_ROOT_VIEWS_START, ATTACH_MEASURED_ROOT_VIEWS_START,
ATTACH_MEASURED_ROOT_VIEWS_END, ATTACH_MEASURED_ROOT_VIEWS_END,
CONTENT_APPEARED, CONTENT_APPEARED,
RELOAD,
DOWNLOAD_START,
DOWNLOAD_END,
} }

View File

@ -9,6 +9,8 @@
package com.facebook.react.devsupport; package com.facebook.react.devsupport;
import com.facebook.react.bridge.ReactMarker;
import com.facebook.react.bridge.ReactMarkerConstants;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.io.File; import java.io.File;
@ -639,6 +641,8 @@ public class DevSupportManagerImpl implements
public void handleReloadJS() { public void handleReloadJS() {
UiThreadUtil.assertOnUiThread(); UiThreadUtil.assertOnUiThread();
ReactMarker.logMarker(ReactMarkerConstants.RELOAD);
// dismiss redbox if exists // dismiss redbox if exists
if (mRedBoxDialog != null) { if (mRedBoxDialog != null) {
mRedBoxDialog.dismiss(); mRedBoxDialog.dismiss();
@ -830,6 +834,8 @@ public class DevSupportManagerImpl implements
} }
public void reloadJSFromServer(final String bundleURL) { public void reloadJSFromServer(final String bundleURL) {
ReactMarker.logMarker(ReactMarkerConstants.DOWNLOAD_START);
mDevLoadingViewController.showForUrl(bundleURL); mDevLoadingViewController.showForUrl(bundleURL);
mDevLoadingViewVisible = true; mDevLoadingViewVisible = true;
@ -846,6 +852,7 @@ public class DevSupportManagerImpl implements
new Runnable() { new Runnable() {
@Override @Override
public void run() { public void run() {
ReactMarker.logMarker(ReactMarkerConstants.DOWNLOAD_END);
mReactInstanceCommandsHandler.onJSBundleLoadedFromServer(); mReactInstanceCommandsHandler.onJSBundleLoadedFromServer();
} }
}); });

View File

@ -128,7 +128,7 @@ static void logPerfMarker(const ReactMarker::ReactMarkerId markerId, const char*
JReactMarker::logMarker("RUN_JS_BUNDLE_START", tag); JReactMarker::logMarker("RUN_JS_BUNDLE_START", tag);
break; break;
case ReactMarker::RUN_JS_BUNDLE_STOP: case ReactMarker::RUN_JS_BUNDLE_STOP:
JReactMarker::logMarker("RUN_JS_BUNDLE_END"); JReactMarker::logMarker("RUN_JS_BUNDLE_END", tag);
break; break;
case ReactMarker::CREATE_REACT_CONTEXT_STOP: case ReactMarker::CREATE_REACT_CONTEXT_STOP:
JReactMarker::logMarker("CREATE_REACT_CONTEXT_END"); JReactMarker::logMarker("CREATE_REACT_CONTEXT_END");

View File

@ -301,7 +301,7 @@ void JSCExecutor::loadApplicationScript(std::unique_ptr<const JSBigString> scrip
flush(); flush();
ReactMarker::logMarker(ReactMarker::CREATE_REACT_CONTEXT_STOP); ReactMarker::logMarker(ReactMarker::CREATE_REACT_CONTEXT_STOP);
ReactMarker::logMarker(ReactMarker::RUN_JS_BUNDLE_STOP); ReactMarker::logTaggedMarker(ReactMarker::RUN_JS_BUNDLE_STOP, scriptName.c_str());
return; return;
case JSLoadSourceErrorVersionMismatch: case JSLoadSourceErrorVersionMismatch:
@ -350,7 +350,7 @@ void JSCExecutor::loadApplicationScript(std::unique_ptr<const JSBigString> scrip
flush(); flush();
ReactMarker::logMarker(ReactMarker::CREATE_REACT_CONTEXT_STOP); ReactMarker::logMarker(ReactMarker::CREATE_REACT_CONTEXT_STOP);
ReactMarker::logMarker(ReactMarker::RUN_JS_BUNDLE_STOP); ReactMarker::logTaggedMarker(ReactMarker::RUN_JS_BUNDLE_STOP, scriptName.c_str());
} }
void JSCExecutor::setJSModulesUnbundle(std::unique_ptr<JSModulesUnbundle> unbundle) { void JSCExecutor::setJSModulesUnbundle(std::unique_ptr<JSModulesUnbundle> unbundle) {