Make the pattern for adding systrace sections more concise

Reviewed By: astreet

Differential Revision: D3234834

fbshipit-source-id: 73e191deb4dd0e06d4c242e46a582051d4bcc9ba
This commit is contained in:
Marc Horowitz authored and Facebook Github Bot 8 committed 2016-05-13 17:29:00 -07:00
1 parent 267264f1ec
commit f433ed716c
5 files changed
+59 -66

No files matched your search

+5 -11
View File
@@ -3,11 +3,7 @@
#include "ModuleRegistry.h"
#include "NativeModule.h"
#ifdef WITH_FBSYSTRACE
#include <fbsystrace.h>
using fbsystrace::FbSystraceSection;
#endif
#include "SystraceSection.h"
namespace facebook {
namespace react {
@@ -24,9 +20,8 @@ folly::dynamic ModuleRegistry::moduleDescriptions() {
folly::dynamic methodDescs = folly::dynamic::object;
std::vector<MethodDescriptor> methods;
{
#ifdef WITH_FBSYSTRACE
FbSystraceSection s(TRACE_TAG_REACT_CXX_BRIDGE, "getMethods", "module", module->getName());
#endif
SystraceSection s("getMethods",
"module", module->getName());
methods = module->getMethods();
}
for (size_t methodId = 0; methodId < methods.size(); ++methodId) {
@@ -38,9 +33,8 @@ folly::dynamic ModuleRegistry::moduleDescriptions() {
folly::dynamic constants = folly::dynamic::array();
{
#ifdef WITH_FBSYSTRACE
FbSystraceSection s(TRACE_TAG_REACT_CXX_BRIDGE, "getConstants", "module", module->getName());
#endif
SystraceSection s("getConstants",
"module", module->getName());
constants = module->getConstants();
}