QDP++
qdp_stopwatch.h
Go to the documentation of this file.
1// -*- C++ -*-
7
8#ifndef QDP_STOPWATCH_H
9#define QDP_STOPWATCH_H
10
11#include<sys/time.h>
12
13namespace QDP {
14
22{
23public:
25 StopWatch();
26
28 ~StopWatch();
29
31 void reset();
32
34 void start();
35
37 void stop();
38
40 double getTimeInMicroseconds();
41
43 double getTimeInSeconds();
44
45private:
46 long sec;
47 long usec;
48 bool startedP;
49 bool stoppedP;
50 bool state;
51
52 struct timeval t_start;
53 struct timeval t_end;
54
55 void calcDuration(long&,long&);
56};
57
58} // namespace QDP
59
60#endif
double getTimeInSeconds()
Get time in seconds.
void reset()
Reset the timer.
~StopWatch()
Destructor.
double getTimeInMicroseconds()
Get time in microseconds.
void start()
Start the timer.
StopWatch()
Constructor.
void stop()
Stop the timer.
Yet another random number generator.