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
16 changes: 13 additions & 3 deletions ReactCommon/react/renderer/debug/SystraceSection.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@
namespace facebook {
namespace react {

/**
* Allow providing an fbsystrace implementation that can short-circuit out
* quickly and can throttle too frequent events so we can get useful traces even
* if rendering etc. is spinning. For throttling we'll need file/line info so we
* use a macro.
*/
#if defined(WITH_LOOM_TRACE)
#define SystraceSection \
static constexpr const char systraceSectionFile[] = __FILE__; \
fbsystrace::FbSystraceSection<systraceSectionFile, __LINE__>
/**
* This is a convenience class to avoid lots of verbose profiling
* #ifdefs. If WITH_FBSYSTRACE is not defined, the optimizer will
Expand All @@ -23,7 +33,7 @@ namespace react {
* different values in different files, there is no inconsistency in the sizes
* of defined symbols.
*/
#ifdef WITH_FBSYSTRACE
#elif defined(WITH_FBSYSTRACE)
struct ConcreteSystraceSection {
public:
template <typename... ConvertsToStringPiece>
Expand All @@ -41,8 +51,8 @@ struct DummySystraceSection {
public:
template <typename... ConvertsToStringPiece>
explicit DummySystraceSection(
const char *name,
ConvertsToStringPiece &&...args) {}
__unused const char *name,
__unused ConvertsToStringPiece &&...args) {}
};
using SystraceSection = DummySystraceSection;
#endif
Expand Down