WallclockTimer added

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1673 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
hellwig
2012-09-21 14:08:10 +00:00
parent d983aecf73
commit 63264b8075
3 changed files with 134 additions and 0 deletions

View File

@ -0,0 +1,55 @@
/**
* \brief The WallclockTimer measures the elapsed time
*
* The WallclockTimer measures the time which is elapsed between start and stop of the timer.
*/
#ifndef __WALLCLOCKTIMER_HPP__
#define __WALLCLOCKTIMER_HPP__
#include <string>
#include <sys/time.h>
#include "Logger.hpp"
namespace fail {
/**
* \class WallclockTimer
*
* The class WallclockTimer contains all functions for start, stop, reset and to get the elapsed
* time.
*/
class WallclockTimer {
private:
bool isRunning;
struct timeval start,end,current;
Logger m_log;
public:
WallclockTimer();
virtual ~WallclockTimer() { }
/**
* Starts the timer.
*/
void startTimer();
/**
* Returns the elapsed time. This works while the timer is running, and if it is stopped.
*/
std::string getRuntime();
/**
* Stops the timer.
*/
void stopTimer();
/**
* Resets the timer. The timer is after a call of reset stopped.
*/
void reset();
};
} // end-of-namespace: fail
#endif // __WALLCLOCKTIMER_HPP__