Bridge++
Ver. 2.0.2
timer.h
Go to the documentation of this file.
1
14
#ifndef TIMER_INCLUDED
15
#define TIMER_INCLUDED
16
17
//#define USE_RUSAGE
18
#undef USE_RUSAGE
19
20
#ifdef USE_RUSAGE
21
#include <sys/resource.h>
22
#endif
23
24
#include <cstdio>
25
#include <time.h>
26
#include <sys/time.h>
27
28
#include "
IO/bridgeIO.h
"
29
using
Bridge::vout
;
30
31
class
Timer
32
{
33
public
:
34
static
const
std::string
class_name
;
35
36
public
:
37
Timer
(
const
std::string&
id
=
""
,
const
bool
report
=
false
)
38
:
is_started
(false),
m_start
(0),
m_elapsed
(0),
m_counter
(0),
39
m_id
(id),
40
m_report_on_exit
(
report
)
41
{}
42
43
~Timer
();
44
45
private
:
46
// non-copyable
47
Timer
(
const
Timer
&);
48
Timer
&
operator=
(
const
Timer
&);
49
50
public
:
51
52
void
start
();
53
void
stop
();
54
void
reset
();
55
56
static
void
timestamp
();
57
58
double
elapsed_sec
()
const
;
59
double
elapsed_msec
()
const
;
60
unsigned
long
get_counter
()
const
;
61
62
void
report
(
const
Bridge::VerboseLevel
vl
=
Bridge::GENERAL
);
63
64
private
:
65
bool
is_started
;
66
double
m_start
;
67
68
double
m_elapsed
;
// sec.
69
unsigned
long
m_counter
;
70
71
std::string
m_id
;
72
bool
m_report_on_exit
;
73
};
74
#endif
/* _TIMER_H_ */
Timer::m_elapsed
double m_elapsed
Definition:
timer.h:68
bridgeIO.h
Timer::operator=
Timer & operator=(const Timer &)
Timer::get_counter
unsigned long get_counter() const
Definition:
timer.cpp:121
Bridge::GENERAL
@ GENERAL
Definition:
bridgeIO.h:45
Timer::~Timer
~Timer()
Definition:
timer.cpp:37
Timer::is_started
bool is_started
Definition:
timer.h:65
Timer::m_report_on_exit
bool m_report_on_exit
Definition:
timer.h:72
Timer
Definition:
timer.h:31
Timer::Timer
Timer(const std::string &id="", const bool report=false)
Definition:
timer.h:37
Timer::m_start
double m_start
Definition:
timer.h:66
Timer::start
void start()
Definition:
timer.cpp:44
Timer::m_id
std::string m_id
Definition:
timer.h:71
ParameterCheck::vl
Bridge::VerboseLevel vl
Definition:
parameterCheck.cpp:18
Timer::m_counter
unsigned long m_counter
Definition:
timer.h:69
Timer::timestamp
static void timestamp()
Definition:
timer.cpp:19
Timer::class_name
static const std::string class_name
Definition:
timer.h:34
Timer::elapsed_msec
double elapsed_msec() const
Definition:
timer.cpp:114
Timer::elapsed_sec
double elapsed_sec() const
Definition:
timer.cpp:107
Bridge::VerboseLevel
VerboseLevel
Definition:
bridgeIO.h:42
Timer::stop
void stop()
Definition:
timer.cpp:69
Timer::report
void report(const Bridge::VerboseLevel vl=Bridge::GENERAL)
Definition:
timer.cpp:128
Bridge::vout
BridgeIO vout
Definition:
bridgeIO.cpp:512
Timer::reset
void reset()
Definition:
timer.cpp:97
src
lib
Tools
timer.h
Generated on Sat Feb 10 2024 14:20:00 for Bridge++ by
1.8.17