Improve systrace markers

Reviewed By: mhorowitz

Differential Revision: D4860135

fbshipit-source-id: ce963010883e6b9cc8e34f7ff01b4018cd195eba
This commit is contained in:
Pieter De Baets
2017-05-12 18:07:49 -07:00
committed by Facebook Github Bot
parent 49e6d3965f
commit 6221053179
16 changed files with 111 additions and 90 deletions
+5 -12
View File
@@ -124,27 +124,21 @@ void NativeToJsBridge::callFunction(
int systraceCookie = -1;
#ifdef WITH_FBSYSTRACE
systraceCookie = m_systraceCookie++;
std::string tracingName = fbsystrace_is_tracing(TRACE_TAG_REACT_CXX_BRIDGE) ?
folly::to<std::string>("JSCall__", module, '_', method) : std::string();
SystraceSection s(tracingName.c_str());
FbSystraceAsyncFlow::begin(
TRACE_TAG_REACT_CXX_BRIDGE,
tracingName.c_str(),
"JSCall",
systraceCookie);
#else
std::string tracingName;
#endif
runOnExecutorQueue([module = std::move(module), method = std::move(method), arguments = std::move(arguments), tracingName = std::move(tracingName), systraceCookie]
runOnExecutorQueue([module = std::move(module), method = std::move(method), arguments = std::move(arguments), systraceCookie]
(JSExecutor* executor) {
#ifdef WITH_FBSYSTRACE
FbSystraceAsyncFlow::end(
TRACE_TAG_REACT_CXX_BRIDGE,
tracingName.c_str(),
"JSCall",
systraceCookie);
SystraceSection s(tracingName.c_str());
SystraceSection s("NativeToJsBridge::callFunction", "module", module, "method", method);
#endif
// This is safe because we are running on the executor's thread: it won't
// destruct until after it's been unregistered (which we check above) and
// that will happen on this thread
@@ -169,9 +163,8 @@ void NativeToJsBridge::invokeCallback(double callbackId, folly::dynamic&& argume
TRACE_TAG_REACT_CXX_BRIDGE,
"<callback>",
systraceCookie);
SystraceSection s("NativeToJsBridge.invokeCallback");
SystraceSection s("NativeToJsBridge::invokeCallback");
#endif
executor->invokeCallback(callbackId, arguments);
});
}