DGtal 1.3.0
Loading...
Searching...
No Matches
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)
37#define Clock_RECURSES
38
39#ifndef Clock_h
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
66namespace DGtal
67{
68
70 // class Clock
95 class Clock
96 {
97 // ----------------------- Standard services ------------------------------
98 // -------------------------- timing services -------------------------------
99 public:
104
109 double stopClock() const;
110
115 double restartClock();
116
122
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)
void selfDisplay(std::ostream &out) const
struct timespec myTimerStart
internal timer object;
Definition: Clock.h:150
bool isValid() const
double restartClock()
void startClock()
double stopClock() const
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)