00001 #ifndef moses_Time_H
00002 #define moses_Time_H
00003
00004 #include <ctime>
00005 #include <iostream>
00006 #include <iomanip>
00007 #include "Util.h"
00008
00009 namespace Moses
00010 {
00011
00012 class Timer
00013 {
00014 friend std::ostream& operator<<(std::ostream& os, Timer& t);
00015
00016 private:
00017 bool running;
00018 time_t start_time;
00019
00020
00021 double elapsed_time();
00022
00023 public:
00024
00025
00026
00027
00028 Timer() : running(false), start_time(0) { }
00029
00030 void start(const char* msg = 0);
00031
00032
00033 void check(const char* msg = 0);
00034 double get_elapsed_time();
00035
00036 };
00037
00038 }
00039
00040 #endif