diff --git a/ReactCommon/react/renderer/debug/SystraceSection.h b/ReactCommon/react/renderer/debug/SystraceSection.h index d3ccd0b4827e..46996ff2bb74 100644 --- a/ReactCommon/react/renderer/debug/SystraceSection.h +++ b/ReactCommon/react/renderer/debug/SystraceSection.h @@ -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 /** * This is a convenience class to avoid lots of verbose profiling * #ifdefs. If WITH_FBSYSTRACE is not defined, the optimizer will @@ -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 @@ -41,8 +51,8 @@ struct DummySystraceSection { public: template explicit DummySystraceSection( - const char *name, - ConvertsToStringPiece &&...args) {} + __unused const char *name, + __unused ConvertsToStringPiece &&...args) {} }; using SystraceSection = DummySystraceSection; #endif