summaryrefslogtreecommitdiff
path: root/utils/timing_stats.h
blob: 69a1cf4b77828f93b0b2daf52420c75e621f1978 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef TIMING_STATS_H_
#define TIMING_STATS_H_

#include <string>
#include <map>

struct TimerInfo {
  int calls;
  double total_time;
  TimerInfo() : calls(), total_time() {}
};

struct Timer {
  Timer(const std::string& info);
  ~Timer();
  static void Summarize();
 private:
  static std::map<std::string, TimerInfo> stats;
  clock_t start_t;
  TimerInfo& cur;
  Timer(const Timer& other);
  const Timer& operator=(const Timer& other);
};

#endif