OpenPose  1.0.0rc2
OpenPose: A Real-Time Multi-Person Key-Point Detection And Multi-Threading C++ Library
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
profiler.hpp
Go to the documentation of this file.
1 #ifndef OPENPOSE_UTILITIES_PROFILER_HPP
2 #define OPENPOSE_UTILITIES_PROFILER_HPP
3 
4 #include <string>
6 
7 // Enable PROFILER_ENABLED on Makefile.config in order to use this function. Otherwise nothing will be outputted.
8 
9 // How to use - example:
10 // For GPU - It can only be applied in the main.cpp file:
11  // Profiler::profileGpuMemory(__LINE__, __FUNCTION__, __FILE__);
12 // For time:
13  // // ... inside continuous loop ...
14  // const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__);
15  // // functions to do...
16  // Profiler::timerEnd(profilerKey);
17  // Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X);
18 
19 namespace op
20 {
22  {
23  public:
24  static const unsigned long long DEFAULT_X;
25 
26  static const std::string timerInit(const int line, const std::string& function, const std::string& file);
27 
28  static void timerEnd(const std::string& key);
29 
30  static void printAveragedTimeMsOnIterationX(const std::string& key, const int line, const std::string& function, const std::string& file, const unsigned long long x = DEFAULT_X);
31 
32  static void printAveragedTimeMsEveryXIterations(const std::string& key, const int line, const std::string& function, const std::string& file, const unsigned long long x = DEFAULT_X);
33 
34  static void profileGpuMemory(const int line, const std::string& function, const std::string& file);
35  };
36 }
37 
38 #endif // OPENPOSE_UTILITIES_PROFILER_HPP
static const unsigned long long DEFAULT_X
Definition: profiler.hpp:24
Definition: profiler.hpp:21
#define OP_API
Definition: macros.hpp:5