22 #ifndef _PORTABLE_TIMER_HH 23 #define _PORTABLE_TIMER_HH 31 #define USEC_IN_SEC 1000000 59 startVal.QuadPart = 0;
61 QueryPerformanceFrequency(&frequency);
64 void start() { QueryPerformanceCounter(&startVal); }
66 void stop() { QueryPerformanceCounter(&stopVal); }
70 time.QuadPart = stopVal.QuadPart - startVal.QuadPart;
71 return LIToSecs(time);
79 double LIToSecs(LARGE_INTEGER&
L) {
80 return ((
double)L.QuadPart /(
double)frequency.QuadPart) ;
83 LARGE_INTEGER startVal;
84 LARGE_INTEGER stopVal;
85 LARGE_INTEGER frequency;
90 #elif defined(__APPLE__) 91 #include <CoreServices/CoreServices.h> 92 #include <mach/mach_time.h> 134 #include <sys/time.h> 135 #include <sys/resource.h> 137 #include <sys/times.h> 155 m_start_time = double(ts.tv_sec) + 1
e-9 * double(ts.tv_nsec);
163 m_stop_time = double(ts.tv_sec) + 1
e-9 * double(ts.tv_nsec);
187 #endif // PORTABLE_TIMER_HPP
Portable_Timer(int clkid)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
static BtlConfig Instance