hyperion.ng
Profiler.h
1 #include <stdio.h>
2 #include <stdarg.h>
3 #include <time.h>
4 #include <map>
5 #include <utils/Logger.h>
6 #include <HyperionConfig.h>
7 
8 #ifndef ENABLE_PROFILER
9  #error "Profiler is not for productive code, enable it via cmake or remove header include"
10 #endif
11 
12 // profiler
13 #define PROFILER_BLOCK_EXECUTION_TIME Profiler DEBUG_PROFILE__BLOCK__EXECUTION__TIME_messure_object(__FILE__, _FUNCNAME_, __LINE__ );
14 #define PROFILER_TIMER_START(stopWatchName) Profiler::TimerStart(stopWatchName, __FILE__, _FUNCNAME_, __LINE__);
15 #define PROFILER_TIMER_GET(stopWatchName) Profiler::TimerGetTime(stopWatchName, __FILE__, _FUNCNAME_, __LINE__);
16 #define PROFILER_TIMER_GET_IF(condition, stopWatchName) { if (condition) {Profiler::TimerGetTime(stopWatchName, __FILE__, _FUNCNAME_, __LINE__);} }
17 
18 
19 class Profiler
20 {
21 public:
22  Profiler(const char* sourceFile, const char* func, unsigned int line);
23  ~Profiler();
24 
25  static void TimerStart(const QString stopWatchName, const char* sourceFile, const char* func, unsigned int line);
26  static void TimerGetTime(const QString stopWatchName, const char* sourceFile, const char* func, unsigned int line);
27 
28 private:
29  static void initLogger();
30 
31  static Logger* _logger;
32  const char* _file;
33  const char* _func;
34  unsigned int _line;
35  unsigned int _blockId;
36  clock_t _startTime;
37 };
Definition: Logger.h:32
Definition: Profiler.h:19