OGS
CPUTime.h
Go to the documentation of this file.
1
15#pragma once
16
17#include <ctime>
18
19namespace BaseLib
20{
23{
24public:
26 void start() { start_time_ = clock(); }
27
29 double elapsed() const
30 {
31 return (clock() - start_time_) / static_cast<double>(CLOCKS_PER_SEC);
32 }
33
34private:
35 double start_time_ = 0.;
36};
37
38} // end namespace BaseLib
Count CPU time.
Definition CPUTime.h:23
void start()
Start the timer.
Definition CPUTime.h:26
double start_time_
Definition CPUTime.h:35
double elapsed() const
Get the elapsed time after started.
Definition CPUTime.h:29