Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions packages/react-native/ReactCommon/cxxreact/SystraceSection.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
#include <fbsystrace.h>
#endif

#ifdef WITH_PERFETTO
#include <perfetto.h>
#include <reactperflogger/ReactPerfettoCategories.h>
#endif

#if defined(__APPLE__)
// This is required so that OS_LOG_TARGET_HAS_10_15_FEATURES will be set.
#include <os/trace_base.h>
Expand Down Expand Up @@ -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 <typename... ConvertsToStringPiece>
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:
Expand Down