mirror of
https://github.com/status-im/react-native.git
synced 2025-01-10 09:35:48 +00:00
f433ed716c
Reviewed By: astreet Differential Revision: D3234834 fbshipit-source-id: 73e191deb4dd0e06d4c242e46a582051d4bcc9ba
34 lines
764 B
C++
34 lines
764 B
C++
// Copyright 2004-present Facebook. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#ifdef WITH_FBSYSTRACE
|
|
#include <fbsystrace.h>
|
|
#endif
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
/**
|
|
* This is a convenience class to avoid lots of verbose profiling
|
|
* #ifdefs. If WITH_FBSYSTRACE is not defined, the optimizer will
|
|
* remove this completely. If it is defined, it will behave as
|
|
* FbSystraceSection, with the right tag provided.
|
|
*/
|
|
struct SystraceSection {
|
|
public:
|
|
template<typename... ConvertsToStringPiece>
|
|
explicit SystraceSection(const char* name, ConvertsToStringPiece&&... args)
|
|
#ifdef WITH_FBSYSTRACE
|
|
: m_section(TRACE_TAG_REACT_CXX_BRIDGE, name, args...)
|
|
#endif
|
|
{}
|
|
|
|
private:
|
|
#ifdef WITH_FBSYSTRACE
|
|
fbsystrace::FbSystraceSection m_section;
|
|
#endif
|
|
};
|
|
|
|
}}
|