18 #ifndef IGNITION_COMMON_PROFILER_HH_ 19 #define IGNITION_COMMON_PROFILER_HH_ 24 #include <ignition/common/profiler/Export.hh> 26 #include <ignition/common/config.hh> 56 class IGNITION_COMMON_PROFILER_VISIBLE
Profiler 67 public:
void SetThreadName(
const char *_name);
75 public:
void LogText(
const char *_text);
84 public:
void BeginSample(
const char *_name, uint32_t *_hash =
nullptr);
87 public:
void EndSample();
93 public:
bool Valid()
const;
96 private: ProfilerImpl *impl;
125 #ifndef IGN_PROFILER_ENABLE 126 #define IGN_PROFILER_ENABLE 0 130 #if IGN_PROFILER_ENABLE 131 #define IGN_PROFILE_THREAD_NAME(name) \ 133 ignition::common::Profiler::Instance()->SetThreadName(name); 134 #define IGN_PROFILE_LOG_TEXT(name) \ 136 ignition::common::Profiler::Instance()->LogText(name); 137 #define IGN_PROFILE_BEGIN(name) \ 139 ignition::common::Profiler::Instance()->BeginSample(name) 140 #define IGN_PROFILE_END() \ 142 ignition::common::Profiler::Instance()->EndSample() 145 #define IGN_PROFILE_L(name, line) \ 146 static uint32_t __hash##line = 0; \ 147 ignition::common::ScopedProfile __profile##line(name, &__hash##line); 148 #define IGN_PROFILE(name) IGN_PROFILE_L(name, __LINE__); 153 #define IGN_PROFILE_THREAD_NAME(name) ((void) name) 154 #define IGN_PROFILE_LOG_TEXT(name) ((void) name) 155 #define IGN_PROFILE_BEGIN(name) ((void) name) 156 #define IGN_PROFILE_END() ((void) 0) 157 #define IGN_PROFILE_L(name, line) ((void) name) 158 #define IGN_PROFILE(name) ((void) name) 159 #endif // IGN_PROFILER_ENABLE 162 #define IGN_PROFILER_VALID \ 163 IGN_PROFILER_ENABLE && ignition::common::Profiler::Instance()->Valid() 165 #endif // IGNITION_COMMON_PROFILER_HH_ Used to provide C++ RAII-style profiling sample. The sample will start on the construction of the Sco...
Definition: Profiler.hh:105
~ScopedProfile()
Destructor. Stops profile sample.
Definition: Profiler.hh:117
void EndSample()
End a profiling sample.
void BeginSample(const char *_name, uint32_t *_hash=nullptr)
Begin a named profiling sample. Begins a CPU profiler sample with a given name. Can optionally take a...
static Profiler * Instance()
Get an instance of the singleton.
Definition: SingletonT.hh:30
Singleton template class.
Definition: SingletonT.hh:27
ScopedProfile(const char *_name, uint32_t *_hash)
Constructor. Starts profile sample.
Definition: Profiler.hh:111
Forward declarations for the common classes.
Used to perform application-wide performance profiling.
Definition: Profiler.hh:56