Skip to content

Commit

Permalink
add perf markers for reload and download
Browse files Browse the repository at this point in the history
Reviewed By: alexeylang

Differential Revision: D5633613

fbshipit-source-id: 1fe39669cf4ba4e1475bb57de59c696771ebf8c7
  • Loading branch information
bnham authored and facebook-github-bot committed Aug 17, 2017
1 parent 30d9c3d commit c080fe5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
Expand Up @@ -67,4 +67,7 @@ public enum ReactMarkerConstants {
ATTACH_MEASURED_ROOT_VIEWS_START,
ATTACH_MEASURED_ROOT_VIEWS_END,
CONTENT_APPEARED,
RELOAD,
DOWNLOAD_START,
DOWNLOAD_END,
}
Expand Up @@ -9,6 +9,8 @@

package com.facebook.react.devsupport;

import com.facebook.react.bridge.ReactMarker;
import com.facebook.react.bridge.ReactMarkerConstants;
import javax.annotation.Nullable;

import java.io.File;
Expand Down Expand Up @@ -639,6 +641,8 @@ public void reloadSettings() {
public void handleReloadJS() {
UiThreadUtil.assertOnUiThread();

ReactMarker.logMarker(ReactMarkerConstants.RELOAD);

// dismiss redbox if exists
if (mRedBoxDialog != null) {
mRedBoxDialog.dismiss();
Expand Down Expand Up @@ -830,6 +834,8 @@ public void onFailure(final Throwable cause) {
}

public void reloadJSFromServer(final String bundleURL) {
ReactMarker.logMarker(ReactMarkerConstants.DOWNLOAD_START);

mDevLoadingViewController.showForUrl(bundleURL);
mDevLoadingViewVisible = true;

Expand All @@ -846,6 +852,7 @@ public void onSuccess() {
new Runnable() {
@Override
public void run() {
ReactMarker.logMarker(ReactMarkerConstants.DOWNLOAD_END);
mReactInstanceCommandsHandler.onJSBundleLoadedFromServer();
}
});
Expand Down
2 changes: 1 addition & 1 deletion ReactAndroid/src/main/jni/react/jni/OnLoad.cpp
Expand Up @@ -128,7 +128,7 @@ static void logPerfMarker(const ReactMarker::ReactMarkerId markerId, const char*
JReactMarker::logMarker("RUN_JS_BUNDLE_START", tag);
break;
case ReactMarker::RUN_JS_BUNDLE_STOP:
JReactMarker::logMarker("RUN_JS_BUNDLE_END");
JReactMarker::logMarker("RUN_JS_BUNDLE_END", tag);
break;
case ReactMarker::CREATE_REACT_CONTEXT_STOP:
JReactMarker::logMarker("CREATE_REACT_CONTEXT_END");
Expand Down
4 changes: 2 additions & 2 deletions ReactCommon/cxxreact/JSCExecutor.cpp
Expand Up @@ -301,7 +301,7 @@ void JSCExecutor::loadApplicationScript(std::unique_ptr<const JSBigString> scrip
flush();

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;

case JSLoadSourceErrorVersionMismatch:
Expand Down Expand Up @@ -350,7 +350,7 @@ void JSCExecutor::loadApplicationScript(std::unique_ptr<const JSBigString> scrip
flush();

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) {
Expand Down

0 comments on commit c080fe5

Please sign in to comment.