EPICS ARCHIVER V4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
BenchTimer.h
1 // -*- c++ -*-
2 
3 #ifndef __BENCHTIMER_H__
4 #define __BENCHTIMER_H__
5 
6 // epics
7 #include <epicsTime.h>
8 
9 #include <string>
10 
12 
15 {
16 public:
19  { start(); }
20 
22  void start()
23  { t0 = epicsTime::getCurrent(); }
24 
26  double stop()
27  {
28  t1 = epicsTime::getCurrent();
29  return runtime();
30  }
31 
33  double runtime()
34  { return t1 - t0; }
35 
37  std::string toString();
38 
39 private:
40  epicsTime t0, t1;
41 };
42 
43 #endif
double stop()
Stop the timer, returns the seconds of runtime.
Definition: BenchTimer.h:26
Start/stop type of timer.
Definition: BenchTimer.h:14
BenchTimer()
Constructor, also invokes start().
Definition: BenchTimer.h:18
void start()
Start or re-start the timer.
Definition: BenchTimer.h:22
double runtime()
Runtime of the last start...stop cycle.
Definition: BenchTimer.h:33
std::string toString()
Printable representation of runtime().