-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimer.h
More file actions
40 lines (34 loc) · 1.06 KB
/
Copy pathTimer.h
File metadata and controls
40 lines (34 loc) · 1.06 KB
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
#pragma once
#include <chrono>
#include <string>
using HrClock = std::chrono::high_resolution_clock;
using eTime = std::chrono::duration<double>;
using TPoint = std::chrono::high_resolution_clock::time_point;
/*
Start the timer.
THE TIMER MUST NOT BE A POINTER !
Timer use it's life cycle to time your function, so it's better to allocate it on the stack,
if you do allocate it on the heap DESTROY IT!
Args:
fctName = function name or the name of the part you want to debug.
DEFAULT : "NO NAME"
use __func__ to get the function name.
*/
class Timer {
private:
TPoint start;
std::string fctName;
public:
/*
Start the timer.
THE TIMER MUST NOT BE A POINTER !
Timer use it's life cycle to time your function, so it's better to allocate it on the stack,
if you do allocate it on the heap DESTROY IT!
Args:
fctName = function name or the name of the part you want to debug.
DEFAULT : "NO NAME"
use __func__ to get the function name.
*/
Timer(std::string fctName = "NO NAME");
~Timer();
};