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

#include <ctime>

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:
  std::clock_t start_t;
};

#endif