44 # define WIN32_LEAN_AND_MEAN
48 # include <sys/time.h>
78 #ifndef MEASURE_FUNCTION_TIME
79 #define MEASURE_FUNCTION_TIME \
80 ScopeTimeCPU scopeTime(__func__)
87 #define DO_EVERY_TS(secs, currentTime, code) \
89 static double s_lastDone_ = 0.0; \
90 double s_now_ = (currentTime); \
91 if (s_lastDone_ > s_now_) \
92 s_lastDone_ = s_now_; \
93 if (s_now_ - s_lastDone_ > (secs)) { \
95 s_lastDone_ = s_now_; \
103 #define DO_EVERY(secs, code) \
104 DO_EVERY_TS(secs, pcl::cuda::getTime(), code)
115 LARGE_INTEGER frequency;
116 LARGE_INTEGER timer_tick;
117 QueryPerformanceFrequency(&frequency);
118 QueryPerformanceCounter(&timer_tick);
119 return (
double)(timer_tick.QuadPart)/(
double)frequency.QuadPart;
121 timeval current_time;
122 gettimeofday (¤t_time,
nullptr);
123 return (current_time.tv_sec + 1e-6 * current_time.tv_usec);
135 double duration = end_time - start_time_;
136 std::cerr << title_ <<
" took " << 1000 * duration <<
"ms. " << std::endl;
Class to measure the time spent in a scope.
ScopeTimeCPU(const char *title)