Skip to content

Commit b3341d3

Browse files
James Moranmeta-codesync[bot]
authored andcommitted
Replace hz_tracing V1 macros with newer V2 variants (facebook#54036)
Summary: Pull Request resolved: facebook#54036 We are migrating away from the older V1 macros to the V2 macros, which have better code-stripped functionality and less business logic embedded in the API. Changelog: [Internal] Reviewed By: christophpurrer Differential Revision: D83760301 fbshipit-source-id: b6c9ea155ebe22d6d4ce023a1dbb2cfd52fb8394
1 parent fc60030 commit b3341d3

File tree

2 files changed

+36
-16
lines changed

2 files changed

+36
-16
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
#include "tracy_noop.h"
9+
10+
#if RNCXX_WITH_PROFILING_PROVIDER
11+
HZT_DEFINE_STATIC_STORAGE(facebook::react);
12+
#endif

packages/react-native/ReactCxxPlatform/react/profiling/tracy_noop.h

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,30 @@
1212
#endif
1313

1414
#if RNCXX_WITH_PROFILING_PROVIDER
15-
#include <hz_tracing/TracingMacros.h>
16-
17-
#define SCOPED_TRACE_CPU_AUTO() \
18-
HZT_TRACE_SCOPE_AUTO( \
19-
::horizon::tracing::TraceLevel::Important, \
20-
::horizon::tracing::EventCategory::Update, \
21-
"react_native", \
22-
::horizon::tracing::DestinationFlag::Default);
23-
24-
#define SCOPED_TRACE_CPU(name) \
25-
HZT_TRACE_SCOPE( \
26-
name, \
27-
::horizon::tracing::TraceLevel::Important, \
28-
::horizon::tracing::EventCategory::Update, \
29-
"react_native", \
30-
::horizon::tracing::DestinationFlag::Default);
15+
#include <hz_tracing/v2/TracingMacros.h>
16+
17+
#ifndef TRACE_FUNCTION
18+
#if defined(__GNUC__) || defined(__clang__)
19+
#define TRACE_FUNCTION __PRETTY_FUNCTION__
20+
#else
21+
#define TRACE_FUNCTION __FUNCTION__
22+
#endif
23+
#endif // TRACE_FUNCTION
24+
25+
static inline constexpr char kTraceCategory[] = "react_native";
26+
27+
HZT_DEFINE_TRACING_CATEGORIES(
28+
facebook::react,
29+
horizon::tracing::v2::Category(
30+
kTraceCategory,
31+
"react_native",
32+
horizon::tracing::v2::StrippingLevel::Important));
33+
34+
#define SCOPED_TRACE_CPU_AUTO() \
35+
HZT_TRACE_SCOPE_NS_V2(::facebook::react, kTraceCategory, TRACE_FUNCTION);
36+
37+
#define SCOPED_TRACE_CPU(name) \
38+
HZT_TRACE_SCOPE_NS_V2(::facebook::react, kTraceCategory, name);
3139

3240
#else
3341
#ifndef SCOPED_TRACE_CPU_AUTO

0 commit comments

Comments
 (0)