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
This commit is contained in:
Ram N 2018-07-26 15:18:22 -07:00 коммит произвёл Facebook Github Bot
Родитель 1bc52267f5
Коммит c7fdd2701f
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -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;