n2p2 - A neural network potential package
|
Implements a simple stopwatch on different platforms. More...
#include <Stopwatch.h>
Public Member Functions | |
Stopwatch () | |
void | start (bool newLoop=true) |
Start the stopwatch. More... | |
double | stop () |
Stop and return total time. More... | |
double | loop () |
Stop and return loop time. More... | |
double | getTotal () const |
Return total time elapsed (of a stopped watch). More... | |
double | getLoop () const |
Return time elapsed in last loop interval (of a stopped watch). More... | |
void | reset () |
Reset stopwatch (total and loop time zero, clock not running). More... | |
Private Types | |
enum | State { STOPPED , RUNNING } |
Private Member Functions | |
void | stopTime () |
double | updateTime () |
Private Attributes | |
State | state |
bool | resetLoop |
double | timeTotal |
double | timeLoop |
Static Private Attributes | |
static const double | NSEC = 1E-9 |
Implements a simple stopwatch on different platforms.
Definition at line 38 of file Stopwatch.h.
|
private |
Enumerator | |
---|---|
STOPPED | |
RUNNING |
Definition at line 63 of file Stopwatch.h.
Stopwatch::Stopwatch | ( | ) |
Definition at line 24 of file Stopwatch.cpp.
void Stopwatch::start | ( | bool | newLoop = true | ) |
Start the stopwatch.
[in] | resetLoop | Optional. If true reset loop time, i.e. this start() call is then also the beginning of a new loop. Use false if you want to accumulate further time in the loop timer. Default: true . |
Definition at line 40 of file Stopwatch.cpp.
References RUNNING, state, STOPPED, and timeLoop.
Referenced by runTest().
double Stopwatch::stop | ( | ) |
Stop and return total time.
Definition at line 62 of file Stopwatch.cpp.
References getTotal(), and stopTime().
Referenced by runTest().
double Stopwatch::loop | ( | ) |
Stop and return loop time.
Definition at line 69 of file Stopwatch.cpp.
References getLoop(), and stopTime().
|
inline |
Return total time elapsed (of a stopped watch).
Definition at line 56 of file Stopwatch.h.
References timeTotal.
Referenced by stop().
|
inline |
Return time elapsed in last loop interval (of a stopped watch).
Definition at line 58 of file Stopwatch.h.
References timeLoop.
Referenced by loop().
void Stopwatch::reset | ( | ) |
Reset stopwatch (total and loop time zero, clock not running).
Definition at line 76 of file Stopwatch.cpp.
References state, STOPPED, timeLoop, and timeTotal.
Referenced by runTest().
|
private |
Definition at line 92 of file Stopwatch.cpp.
References state, STOPPED, timeLoop, timeTotal, and updateTime().
Referenced by loop(), and stop().
|
private |
Definition at line 102 of file Stopwatch.cpp.
References NSEC, RUNNING, and state.
Referenced by stopTime().
|
private |
Definition at line 69 of file Stopwatch.h.
Referenced by reset(), start(), stopTime(), Stopwatch(), and updateTime().
|
private |
Definition at line 70 of file Stopwatch.h.
|
staticprivate |
Definition at line 71 of file Stopwatch.h.
Referenced by updateTime().
|
private |
Definition at line 72 of file Stopwatch.h.
Referenced by getTotal(), reset(), stopTime(), and Stopwatch().
|
private |
Definition at line 73 of file Stopwatch.h.
Referenced by getLoop(), reset(), start(), stopTime(), and Stopwatch().