SaDVIO
include
utilities
timer.h
Go to the documentation of this file.
1
#ifndef TIMER_H
2
#define TIMER_H
3
4
#include <string>
5
6
namespace
isae
{
7
8
//< time measurement utils
9
namespace
timer {
10
11
class
timer_handle
;
12
16
void
tic
();
21
double
silentToc
();
22
28
double
toc
(std::string s=
""
);
29
36
class
timer_handle
{
37
public
:
38
43
timer_handle
(std::string name){
44
this->name=name;
45
tic
();
46
}
47
52
double
toc
(){
53
if
(!_toced){
54
_toced =
true
;
55
return
timer::toc
(name);
56
}
57
return
-1;
58
}
59
60
~timer_handle
(){
61
this->
toc
();
62
}
63
private :
64
bool
_toced =
false
;
//< has already been stoped ?
65
std::string name;
//< timer message
66
timer_handle
(
timer_handle
&)=
delete
;
67
};
68
69
70
}}
71
#endif // TIMER_H
isae::timer::timer_handle::timer_handle
timer_handle(std::string name)
starts the timer
Definition:
timer.h:43
isae::timer::silentToc
double silentToc()
pops a time from the stack and returns the difference with the current time
Definition:
timer.cpp:23
isae::timer::timer_handle::toc
double toc()
stops the timer
Definition:
timer.h:52
isae::timer::timer_handle
Handy way for timing an action.
Definition:
timer.h:36
isae::timer::timer_handle::~timer_handle
~timer_handle()
Definition:
timer.h:60
isae::timer::tic
void tic()
pushes the current time on the stack
Definition:
timer.cpp:12
isae
Definition:
AFeature2D.h:8
isae::timer::toc
double toc(std::string s="")
pops a time from the stack and prints the difference with the current time
Definition:
timer.cpp:16
Generated by
1.8.17