OpenPose  1.0.0rc2
OpenPose: A Real-Time Multi-Person Key-Point Detection And Multi-Threading C++ Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends 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__, NUMBER_ITERATIONS);
18 
19 namespace op
20 {
22  {
23  public:
24  static unsigned long long DEFAULT_X;
25 
26  // Non-thread safe, it must be performed at the beginning of the code before any parallelization occurs
27  static void setDefaultX(const unsigned long long defaultX);
28 
29  static const std::string timerInit(const int line, const std::string& function, const std::string& file);
30 
31  static void timerEnd(const std::string& key);
32 
33  static void printAveragedTimeMsOnIterationX(const std::string& key, const int line,
34  const std::string& function, const std::string& file,
35  const unsigned long long x = DEFAULT_X);
36 
37  static void printAveragedTimeMsEveryXIterations(const std::string& key, const int line,
38  const std::string& function, const std::string& file,
39  const unsigned long long x = DEFAULT_X);
40 
41  static void profileGpuMemory(const int line, const std::string& function, const std::string& file);
42  };
43 }
44 
45 #endif // OPENPOSE_UTILITIES_PROFILER_HPP
Definition: profiler.hpp:21
#define OP_API
Definition: macros.hpp:15
static unsigned long long DEFAULT_X
Definition: profiler.hpp:24
std::string string
Definition: cl2.hpp:574