23 lines
357 B
C
23 lines
357 B
C
|
#include <chrono>
|
||
|
#include <iosfwd>
|
||
|
|
||
|
class Timer
|
||
|
{
|
||
|
public:
|
||
|
Timer();
|
||
|
void tic();
|
||
|
void toc();
|
||
|
|
||
|
friend std::ostream& operator<<(std::ostream& os, const Timer & timer);
|
||
|
|
||
|
private:
|
||
|
|
||
|
std::chrono::time_point<std::chrono::steady_clock> myT0;
|
||
|
|
||
|
double mySum;
|
||
|
double mySum2;
|
||
|
int myN;
|
||
|
};
|
||
|
|
||
|
std::ostream& operator<<(std::ostream& os, const Timer & timer);
|