LRT14  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator
Profiler.h
1 #ifndef RHESUS_PROFILER_H_
2 #define RHESUS_PROFILER_H_
3 
4 #include <hash_map>
5 #include <string>
6 
7 #include "Stopwatch.h"
8 
9 #include "../Tasks/Mutex.h"
10 
11 namespace Rhesus
12 {
13 namespace Toolkit
14 {
15 namespace Diagnostics
16 {
21  class Profiler
22  {
23  public:
24  static void Clear();
25 
26  static void StartActivity(string taskName);
27  static double End(string taskName);
28 
29  static double GetAverageTime(string taskName);
30  static double GetLastTime(string taskName);
31  static double GetMaxTime(string taskName);
32 
33  static std::hash_map<string, pair<double, int> > CloneAverageTimes();
34  static std::hash_map<string, double> CloneLastTimes();
35  static std::hash_map<string, double> CloneMaxTimes();
36 
37  private:
38  static std::hash_map<string, Stopwatch*> s_profilers;
39  static std::hash_map<string, pair<double, int> > s_averageTimes;
40  static std::hash_map<string, double> s_lastTimes;
41  static std::hash_map<string, double> s_maxTimes;
42 
43  static Rhesus::Toolkit::Tasks::Mutex s_syncObj;
44  };
45 }
46 }
47 }
48 
49 #endif