Skip to content

Commit

Permalink
Added more info to Module Registry systraces
Browse files Browse the repository at this point in the history
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 c7fdd27
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ReactCommon/cxxreact/ModuleRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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());
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c7fdd27

Please sign in to comment.