-
Notifications
You must be signed in to change notification settings - Fork 99
/
Copy pathTimer.h
63 lines (39 loc) · 892 Bytes
/
Timer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
DDS, a bridge double dummy solver.
Copyright (C) 2006-2014 by Bo Haglund /
2014-2018 by Bo Haglund & Soren Hein.
See LICENSE and README.
*/
#ifndef DDS_TIMING_H
#define DDS_TIMING_H
#include <string>
#include <chrono>
using Clock = std::chrono::steady_clock;
using std::chrono::time_point;
using namespace std;
class Timer
{
private:
string name;
int count;
long userCum;
long systCum;
time_point<Clock> user0;
clock_t syst0;
public:
Timer();
~Timer() = default;
void Reset();
void SetName(const string& nameIn);
void Start();
void End();
bool Used() const;
int UserTime() const;
void operator += (const Timer& add);
void operator -= (const Timer& deduct);
string SumLine(
const Timer& divisor,
const string& bname = "") const;
string DetailLine() const;
};
#endif