add marker surrounding entire native module creation

Reviewed By: javache

Differential Revision: D5200856

fbshipit-source-id: 35b0e627224d518126a1cfdd36d6af264dd186cf
This commit is contained in:
Ben Nham 2017-06-09 06:11:43 -07:00 committed by Facebook Github Bot
parent 80bc07fd60
commit 2984628357
5 changed files with 21 additions and 1 deletions

View File

@ -97,6 +97,8 @@ static void registerPerformanceLoggerHooks(RCTPerformanceLogger *performanceLogg
case ReactMarker::CREATE_REACT_CONTEXT_STOP: case ReactMarker::CREATE_REACT_CONTEXT_STOP:
case ReactMarker::JS_BUNDLE_STRING_CONVERT_START: case ReactMarker::JS_BUNDLE_STRING_CONVERT_START:
case ReactMarker::JS_BUNDLE_STRING_CONVERT_STOP: case ReactMarker::JS_BUNDLE_STRING_CONVERT_STOP:
case ReactMarker::NATIVE_MODULE_SETUP_START:
case ReactMarker::NATIVE_MODULE_SETUP_STOP:
// These are not used on iOS. // These are not used on iOS.
break; break;
} }

View File

@ -28,6 +28,8 @@ public enum ReactMarkerConstants {
CREATE_VIEW_MANAGERS_END, CREATE_VIEW_MANAGERS_END,
CREATE_UI_MANAGER_MODULE_CONSTANTS_START, CREATE_UI_MANAGER_MODULE_CONSTANTS_START,
CREATE_UI_MANAGER_MODULE_CONSTANTS_END, CREATE_UI_MANAGER_MODULE_CONSTANTS_END,
NATIVE_MODULE_SETUP_START,
NATIVE_MODULE_SETUP_END,
CREATE_MODULE_START, CREATE_MODULE_START,
CREATE_MODULE_END, CREATE_MODULE_END,
PROCESS_CORE_REACT_PACKAGE_START, PROCESS_CORE_REACT_PACKAGE_START,

View File

@ -139,6 +139,12 @@ static void logPerfMarker(const ReactMarker::ReactMarkerId markerId, const char*
case ReactMarker::JS_BUNDLE_STRING_CONVERT_STOP: case ReactMarker::JS_BUNDLE_STRING_CONVERT_STOP:
JReactMarker::logMarker("loadApplicationScript_endStringConvert"); JReactMarker::logMarker("loadApplicationScript_endStringConvert");
break; break;
case ReactMarker::NATIVE_MODULE_SETUP_START:
JReactMarker::logMarker("NATIVE_MODULE_SETUP_START", tag);
break;
case ReactMarker::NATIVE_MODULE_SETUP_STOP:
JReactMarker::logMarker("NATIVE_MODULE_SETUP_END", tag);
break;
case ReactMarker::NATIVE_REQUIRE_START: case ReactMarker::NATIVE_REQUIRE_START:
case ReactMarker::NATIVE_REQUIRE_STOP: case ReactMarker::NATIVE_REQUIRE_STOP:
// These are not used on Android. // These are not used on Android.

View File

@ -4,6 +4,8 @@
#include <string> #include <string>
#include "Platform.h"
namespace facebook { namespace facebook {
namespace react { namespace react {
@ -41,6 +43,8 @@ void JSCNativeModules::reset() {
} }
folly::Optional<Object> JSCNativeModules::createModule(const std::string& name, JSContextRef context) { folly::Optional<Object> JSCNativeModules::createModule(const std::string& name, JSContextRef context) {
ReactMarker::logTaggedMarker(ReactMarker::NATIVE_MODULE_SETUP_START, name.c_str());
if (!m_genNativeModuleJS) { if (!m_genNativeModuleJS) {
auto global = Object::getGlobalObject(context); auto global = Object::getGlobalObject(context);
m_genNativeModuleJS = global.getProperty("__fbGenNativeModule").asObject(); m_genNativeModuleJS = global.getProperty("__fbGenNativeModule").asObject();
@ -58,7 +62,11 @@ folly::Optional<Object> JSCNativeModules::createModule(const std::string& name,
}); });
CHECK(!moduleInfo.isNull()) << "Module returned from genNativeModule is null"; CHECK(!moduleInfo.isNull()) << "Module returned from genNativeModule is null";
return moduleInfo.asObject().getProperty("module").asObject(); folly::Optional<Object> module(moduleInfo.asObject().getProperty("module").asObject());
ReactMarker::logTaggedMarker(ReactMarker::NATIVE_MODULE_SETUP_STOP, name.c_str());
return module;
} }
} } } }

View File

@ -23,6 +23,8 @@ enum ReactMarkerId {
CREATE_REACT_CONTEXT_STOP, CREATE_REACT_CONTEXT_STOP,
JS_BUNDLE_STRING_CONVERT_START, JS_BUNDLE_STRING_CONVERT_START,
JS_BUNDLE_STRING_CONVERT_STOP, JS_BUNDLE_STRING_CONVERT_STOP,
NATIVE_MODULE_SETUP_START,
NATIVE_MODULE_SETUP_STOP,
}; };
using LogTaggedMarker = std::function<void(const ReactMarkerId, const char* tag)>; using LogTaggedMarker = std::function<void(const ReactMarkerId, const char* tag)>;