summaryrefslogtreecommitdiff
path: root/gi/clda/src/timer.h
blob: ca26b304223617cdd108f831b617361a6913b136 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#ifndef _TIMER_STATS_H_
#define _TIMER_STATS_H_

struct Timer {
  Timer() { Reset(); }
  void Reset() {
    start_t = clock();
  }
  double Elapsed() const {
    const clock_t end_t = clock();
    const double elapsed = (end_t - start_t) / 1000000.0;
    return elapsed;
  }
 private:
  clock_t start_t;
};

#endif