diff --git a/packages/react-native/ReactCommon/cxxreact/SystraceSection.h b/packages/react-native/ReactCommon/cxxreact/SystraceSection.h index f661be97142eee..e472374ee62ae7 100644 --- a/packages/react-native/ReactCommon/cxxreact/SystraceSection.h +++ b/packages/react-native/ReactCommon/cxxreact/SystraceSection.h @@ -11,6 +11,11 @@ #include #endif +#ifdef WITH_PERFETTO +#include +#include +#endif + #if defined(__APPLE__) // This is required so that OS_LOG_TARGET_HAS_10_15_FEATURES will be set. #include @@ -44,6 +49,21 @@ namespace facebook::react { * different values in different files, there is no inconsistency in the sizes * of defined symbols. */ +#elif defined(WITH_PERFETTO) +struct TraceSection { + public: + template + explicit TraceSection( + const __unused char* name, + __unused ConvertsToStringPiece&&... args) { + TRACE_EVENT_BEGIN("react-native", perfetto::DynamicString{name}, args...); + } + + ~TraceSection() { + TRACE_EVENT_END("react-native"); + } +}; +using SystraceSectionUnwrapped = TraceSection; #elif defined(WITH_FBSYSTRACE) struct ConcreteSystraceSection { public: