Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Timer.h « src « moses - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a462501435a4ccdb5b33d9d011de7fc2ee3764a4 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef TIMER_H
#define TIMER_H

#include <ctime>
#include <iostream>
#include <iomanip>

namespace Moses
{

class Timer
{
 friend std::ostream& operator<<(std::ostream& os, Timer& t);

 private:
  bool running;
  time_t start_time;

	//TODO in seconds?
  double elapsed_time();

 public:
  /***
   * 'running' is initially false.  A timer needs to be explicitly started
   * using 'start' or 'restart'
   */
  Timer() : running(false), start_time(0) { }

  void start(const char* msg = 0);
//  void restart(const char* msg = 0);
//  void stop(const char* msg = 0);
  void check(const char* msg = 0);
  double get_elapsed_time();

};

}

#endif // TIMER_H