22 inline long double timeCountsToLongDouble(
const LARGE_INTEGER& counts,
const LARGE_INTEGER& frequency)
24 return counts.QuadPart * (1000000.0 / frequency.QuadPart);
29 return (time.tv_sec * 1000000.0) + time.tv_usec;
38 QueryPerformanceFrequency(&frequency_);
39 startCount_.QuadPart = 0;
40 endCount_.QuadPart = 0;
55 QueryPerformanceCounter(&startCount_);
66 QueryPerformanceCounter(&endCount_);
75 LARGE_INTEGER endCount;
79 QueryPerformanceCounter(&endCount);
81 long double startTimeInMicroSec = timeCountsToLongDouble(startCount_, frequency_);
82 long double endTimeInMicroSec = timeCountsToLongDouble(endCount, frequency_);
88 gettimeofday(&end_count, NULL);
94 return endTimeInMicroSec - startTimeInMicroSec;
126 LARGE_INTEGER nowCount;
127 QueryPerformanceCounter(&nowCount);
128 return timeCountsToLongDouble(nowCount);
131 gettimeofday(&now_count, NULL);