-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTimer.h
66 lines (54 loc) · 1.13 KB
/
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
64
65
66
/*
* A header file for a timer to keep track of the time passed
*
* Author wba6
*/
#ifndef PERFORMANCE_ANALYER_TIMER_H
#define PERFORMANCE_ANALYER_TIMER_H
#include <memory>
#include <chrono>
#include <string>
/*
* A timer class to keep track of the time passed between two events
*/
class Timer {
public:
/*
* Constructor for the Timer class
*
* @param std::string name : the name of the timer
* @return void
*/
Timer(std::string name);
/*
* Destructor for the Timer class
*
* @param None
* @return void
*/
~Timer();
/*
* Start the timer
*
* @param None
* @return void
*/
void start();
/*
* Stop the timer
*
* @param None
* @return void
*/
void stop();
private:
// timer name
std::string m_name;
// start time of the timer
std::chrono::time_point<std::chrono::high_resolution_clock> m_startTime;
// end time of the timer
std::chrono::time_point<std::chrono::high_resolution_clock> m_endTime;
// has the timer already stoped
bool m_stopped;
};
#endif //PERFORMANCE_ANALYER_TIMER_H