Permalink
Browse files

Added more info to Module Registry systraces

Summary:
Added module names to systraces for getConstants and getMethods.

Also added systrace for moduleNames.

We are starting to look at ways to optimize native modules, and having these traces helps

Reviewed By: javache

Differential Revision: D9012702

fbshipit-source-id: c79222f36988bef3a108ed91d1ea1318d3576b40
  • Loading branch information...
axe-fb authored and facebook-github-bot committed Jul 26, 2018
1 parent 1bc5226 commit c7fdd2701f7edc1a771a04c890da4d742dca6ffb
Showing with 4 additions and 2 deletions.
  1. +4 −2 ReactCommon/cxxreact/ModuleRegistry.cpp
@@ -41,6 +41,7 @@ void ModuleRegistry::updateModuleNamesFromIndex(size_t index) {
}
void ModuleRegistry::registerModules(std::vector<std::unique_ptr<NativeModule>> modules) {
SystraceSection s_("ModuleRegistry::registerModules");
if (modules_.empty() && unknownModules_.empty()) {
modules_ = std::move(modules);
} else {
@@ -67,6 +68,7 @@ void ModuleRegistry::registerModules(std::vector<std::unique_ptr<NativeModule>>
}
std::vector<std::string> ModuleRegistry::moduleNames() {
SystraceSection s_("ModuleRegistry::moduleNames");
std::vector<std::string> names;
for (size_t i = 0; i < modules_.size(); i++) {
std::string name = normalizeName(modules_[i]->getName());
@@ -106,12 +108,12 @@ folly::Optional<ModuleConfig> ModuleRegistry::getConfig(const std::string& name)
folly::dynamic config = folly::dynamic::array(name);
{
SystraceSection s_("getConstants");
SystraceSection s_("ModuleRegistry::getConstants", "module", name);
config.push_back(module->getConstants());
}
{
SystraceSection s_("getMethods");
SystraceSection s_("ModuleRegistry::getMethods", "module", name);
std::vector<MethodDescriptor> methods = module->getMethods();
folly::dynamic methodNames = folly::dynamic::array;

0 comments on commit c7fdd27

Please sign in to comment.