Skip to content

Commit 1ec1785

Browse files
Unify SystraceSection.h implementation (#35353)
Summary: Pull Request resolved: #35353 Unfortunately we have 2 different definitions of SystraceSection.h - xplat/js/react-native-github/ReactCommon/cxxreact/SystraceSection.h - xplat/js/react-native-github/ReactCommon/react/renderer/debug/SystraceSection.h The first one is the Old Arch one and the second one is the New Arch one. As we first step, we unify the implementation Changelog: [Internal] Reviewed By: rshest Differential Revision: D41307049 fbshipit-source-id: a9eb854dfcf49f87ad81fd9cc8dbe51648ecd209
1 parent 67b8e18 commit 1ec1785

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

ReactCommon/react/renderer/debug/SystraceSection.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@
1414
namespace facebook {
1515
namespace react {
1616

17+
/**
18+
* Allow providing an fbsystrace implementation that can short-circuit out
19+
* quickly and can throttle too frequent events so we can get useful traces even
20+
* if rendering etc. is spinning. For throttling we'll need file/line info so we
21+
* use a macro.
22+
*/
23+
#if defined(WITH_LOOM_TRACE)
24+
#define SystraceSection \
25+
static constexpr const char systraceSectionFile[] = __FILE__; \
26+
fbsystrace::FbSystraceSection<systraceSectionFile, __LINE__>
1727
/**
1828
* This is a convenience class to avoid lots of verbose profiling
1929
* #ifdefs. If WITH_FBSYSTRACE is not defined, the optimizer will
@@ -23,7 +33,7 @@ namespace react {
2333
* different values in different files, there is no inconsistency in the sizes
2434
* of defined symbols.
2535
*/
26-
#ifdef WITH_FBSYSTRACE
36+
#elif defined(WITH_FBSYSTRACE)
2737
struct ConcreteSystraceSection {
2838
public:
2939
template <typename... ConvertsToStringPiece>
@@ -41,8 +51,8 @@ struct DummySystraceSection {
4151
public:
4252
template <typename... ConvertsToStringPiece>
4353
explicit DummySystraceSection(
44-
const char *name,
45-
ConvertsToStringPiece &&...args) {}
54+
__unused const char *name,
55+
__unused ConvertsToStringPiece &&...args) {}
4656
};
4757
using SystraceSection = DummySystraceSection;
4858
#endif

0 commit comments

Comments
 (0)