DGtal
1.1.0
src
DGtal
base
Clock.h
1
17
#pragma once
18
33
#ifdef Clock_RECURSES
34
#error Recursive header files inclusion detected in Clock.h
35
#else // defined(Clock_RECURSES)
36
37
#define Clock_RECURSES
38
39
#ifndef Clock_h
40
41
#define Clock_h
42
44
// Inclusions
45
#include <iostream>
46
#include <cstdlib>
47
48
#if ( (defined(UNIX)||defined(unix)||defined(linux)) )
49
#include <sys/time.h>
50
#include <time.h>
51
#endif
52
53
#ifdef __MACH__
54
#include <mach/clock.h>
55
#include <mach/mach.h>
56
#endif
57
58
#ifdef WIN32
59
#include <time.h>
60
#endif
61
62
63
65
66
namespace
DGtal
67
{
68
70
// class Clock
95
class
Clock
96
{
97
// ----------------------- Standard services ------------------------------
98
// -------------------------- timing services -------------------------------
99
public
:
103
void
startClock
();
104
109
double
stopClock
()
const
;
110
115
double
restartClock
();
116
121
Clock
();
122
126
~Clock
();
127
128
// ----------------------- Interface --------------------------------------
129
public
:
130
135
void
selfDisplay
( std::ostream & out )
const
;
136
141
bool
isValid
()
const
;
142
143
// ------------------------- Private Datas --------------------------------
144
private
:
145
147
#ifdef WIN32
148
clock_t myFirstTick;
149
#else
150
struct
timespec
myTimerStart
;
151
#endif
152
153
};
// end of class Clock
154
155
162
inline
163
std::ostream&
164
operator<<
( std::ostream & out,
const
Clock
&
object
)
165
{
166
object
.selfDisplay( out );
167
return
out;
168
}
169
170
171
}
// namespace DGtal
172
174
// Inline methods
175
#include "DGtal/base/Clock.ih"
176
177
#endif // !defined Clock_h
178
179
#undef Clock_RECURSES
180
#endif // else defined(Clock_RECURSES)
DGtal::Clock::isValid
bool isValid() const
DGtal::Clock::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::Clock::Clock
Clock()
DGtal::Clock::stopClock
double stopClock() const
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition:
ClosedIntegerHalfPlane.h:49
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::Clock::myTimerStart
struct timespec myTimerStart
internal timer object;
Definition:
Clock.h:150
DGtal::Clock::restartClock
double restartClock()
DGtal::Clock
Definition:
Clock.h:96
DGtal::Clock::startClock
void startClock()
DGtal::Clock::~Clock
~Clock()
Generated on Fri Oct 9 2020 08:57:47 for DGtal by
1.8.20