Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
igl::Timer Class Reference

#include <src/libigl/igl/Timer.h>

Public Member Functions

 Timer ()
 
 ~Timer ()
 
void start ()
 
void stop ()
 
double getElapsedTime ()
 
double getElapsedTimeInSec ()
 
double getElapsedTimeInMilliSec ()
 
double getElapsedTimeInMicroSec ()
 

Private Attributes

int stopped
 
timeval startCount
 
timeval endCount
 

Detailed Description

Constructor & Destructor Documentation

◆ Timer()

igl::Timer::Timer ( )
inline
32 :
33 stopped(0),
34#ifdef WIN32
35 frequency(),
36 startCount(),
37 endCount()
38#elif __APPLE__
39 startCount(0),
40 endCount(0)
41#else
42 startCount(),
43 endCount()
44#endif
45 {
46#ifdef WIN32
47 QueryPerformanceFrequency(&frequency);
48 startCount.QuadPart = 0;
49 endCount.QuadPart = 0;
50#elif __APPLE__
51 startCount = 0;
52 endCount = 0;
53#else
54 startCount.tv_sec = startCount.tv_usec = 0;
55 endCount.tv_sec = endCount.tv_usec = 0;
56#endif
57
58 stopped = 0;
59 }
timeval startCount
Definition Timer.h:173
timeval endCount
Definition Timer.h:174
int stopped
Definition Timer.h:163

References endCount, startCount, and stopped.

◆ ~Timer()

igl::Timer::~Timer ( )
inline
62 {
63
64 }

Member Function Documentation

◆ getElapsedTime()

double igl::Timer::getElapsedTime ( )
inline
117 {
118 return this->getElapsedTimeInSec();
119 }
double getElapsedTimeInSec()
Definition Timer.h:121

References getElapsedTimeInSec().

+ Here is the call graph for this function:

◆ getElapsedTimeInMicroSec()

double igl::Timer::getElapsedTimeInMicroSec ( )
inline
133 {
134 double startTimeInMicroSec = 0;
135 double endTimeInMicroSec = 0;
136
137#ifdef WIN32
138 if(!stopped)
139 QueryPerformanceCounter(&endCount);
140
141 startTimeInMicroSec =
142 startCount.QuadPart * (1000000.0 / frequency.QuadPart);
143 endTimeInMicroSec = endCount.QuadPart * (1000000.0 / frequency.QuadPart);
144#elif __APPLE__
145 if (!stopped)
146 endCount = mach_absolute_time();
147
148 return subtractTimes(endCount,startCount)/1e-6;
149#else
150 if(!stopped)
151 gettimeofday(&endCount, NULL);
152
153 startTimeInMicroSec =
154 (startCount.tv_sec * 1000000.0) + startCount.tv_usec;
155 endTimeInMicroSec = (endCount.tv_sec * 1000000.0) + endCount.tv_usec;
156#endif
157
158 return endTimeInMicroSec - startTimeInMicroSec;
159 }
int gettimeofday(struct timeval *tp, struct timezone *tzp)
Definition unistd.cpp:21

References endCount, gettimeofday(), startCount, and stopped.

Referenced by getElapsedTimeInMilliSec(), and getElapsedTimeInSec().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getElapsedTimeInMilliSec()

double igl::Timer::getElapsedTimeInMilliSec ( )
inline
128 {
129 return this->getElapsedTimeInMicroSec() * 0.001;
130 }
double getElapsedTimeInMicroSec()
Definition Timer.h:132

References getElapsedTimeInMicroSec().

+ Here is the call graph for this function:

◆ getElapsedTimeInSec()

double igl::Timer::getElapsedTimeInSec ( )
inline
122 {
123 return this->getElapsedTimeInMicroSec() * 0.000001;
124 }

References getElapsedTimeInMicroSec().

Referenced by getElapsedTime().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ start()

void igl::Timer::start ( )
inline
89 {
90 stopped = 0; // reset stop flag
91#ifdef WIN32
92 QueryPerformanceCounter(&startCount);
93#elif __APPLE__
94 startCount = mach_absolute_time();
95#else
97#endif
98
99 }

References gettimeofday(), startCount, and stopped.

+ Here is the call graph for this function:

◆ stop()

void igl::Timer::stop ( )
inline
103 {
104 stopped = 1; // set timer stopped flag
105
106#ifdef WIN32
107 QueryPerformanceCounter(&endCount);
108#elif __APPLE__
109 endCount = mach_absolute_time();
110#else
111 gettimeofday(&endCount, NULL);
112#endif
113
114 }

References endCount, gettimeofday(), and stopped.

+ Here is the call graph for this function:

Member Data Documentation

◆ endCount

timeval igl::Timer::endCount
private

◆ startCount

timeval igl::Timer::startCount
private

◆ stopped

int igl::Timer::stopped
private

The documentation for this class was generated from the following file: