add timestamps to determine string convert time

Reviewed By: astreet

Differential Revision: D2684174

fb-gh-sync-id: feed759025e131fd913c6188f783d6920ad1839c
This commit is contained in:
Mike Armstrong 2015-11-27 02:04:32 -08:00 committed by facebook-github-bot-4
parent e1533fdff6
commit e1adea86c6
3 changed files with 31 additions and 0 deletions

View File

@ -10,6 +10,7 @@
#include <folly/String.h>
#include <jni/fbjni/Exceptions.h>
#include "Value.h"
#include "jni/OnLoad.h"
#ifdef WITH_JSC_EXTRA_TRACING
#include <react/JSCTracing.h>
@ -96,7 +97,19 @@ JSCExecutor::~JSCExecutor() {
void JSCExecutor::executeApplicationScript(
const std::string& script,
const std::string& sourceURL) {
JNIEnv* env = Environment::current();
jclass markerClass = env->FindClass("com/facebook/react/bridge/ReactMarker");
jmethodID logMarkerMethod = facebook::react::getLogMarkerMethod();
jstring startStringMarker = env->NewStringUTF("executeApplicationScript_startStringConvert");
jstring endStringMarker = env->NewStringUTF("executeApplicationScript_endStringConvert");
env->CallStaticVoidMethod(markerClass, logMarkerMethod, startStringMarker);
String jsScript(script.c_str());
env->CallStaticVoidMethod(markerClass, logMarkerMethod, endStringMarker);
env->DeleteLocalRef(startStringMarker);
env->DeleteLocalRef(endStringMarker);
String jsSourceURL(sourceURL.c_str());
#ifdef WITH_FBSYSTRACE
FbSystraceSection s(TRACE_TAG_REACT_CXX_BRIDGE, "JSCExecutor::executeApplicationScript",

View File

@ -16,6 +16,7 @@
#include "JSLoader.h"
#include "ReadableNativeArray.h"
#include "ProxyExecutor.h"
#include "OnLoad.h"
#ifdef WITH_FBSYSTRACE
#include <fbsystrace.h>
@ -747,6 +748,10 @@ static void createProxyExecutor(JNIEnv *env, jobject obj, jobject executorInstan
}
jmethodID getLogMarkerMethod() {
return bridge::gLogMarkerMethod;
}
extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
return initialize(vm, [] {
// get the current env

View File

@ -0,0 +1,13 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#pragma once
#include <jni.h>
namespace facebook {
namespace react {
jmethodID getLogMarkerMethod();
} // namespace react
} // namespace facebook