PSFEstimationwithCPSO
|
00001 /* 00002 * TimeTracker.h 00003 * 00004 * Created on: 28/09/2011 00005 * Author: Peter Frank Perroni (pfperroni@inf.ufpr.br) 00006 */ 00007 00008 #ifndef _TIMETRACKER_H_ 00009 #define _TIMETRACKER_H_ 00010 00011 #include <sstream> 00012 #include <time.h> 00013 #include <sys/time.h> 00014 00015 using namespace std; 00016 00020 class TimeTracker { 00021 string name; 00022 clock_t startClock, endClock; 00023 struct timeval startTime, endTime; 00024 long double currElapsedTime, currWorkSpent; 00025 bool processing, paused, done; 00026 void resetAll(); 00027 void resetCounters(); 00028 public: 00029 TimeTracker(string _name); 00030 void start(); 00031 void pause(); 00032 void resume(); 00033 long double end(); 00034 long double elapsedTime(); 00035 long double workSpent(); 00036 void reset(); 00041 string getName(){return name;} 00042 void print(void); 00043 void print(ostringstream *out); 00044 void sumWork(TimeTracker *tt); 00045 void sumTime(TimeTracker *tt); 00046 void sum(TimeTracker *tt); 00047 }; 00048 00049 #endif /* _TIMETRACKER_H_ */