summaryrefslogtreecommitdiff
path: root/src/timing_stats.h
blob: 0a9f7656e62c9964ced9a94835a28f44f127d614 (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