Use high-resolution timer on Windows

This fixes a Windows specific issue where the
problem-summary reports timings as zero, as long as
the time difference in question is smaller than one
second.

Change-Id: Ibd91874294423af6acda2575eae80f01aabed6d3
This commit is contained in:
Thomas Gamper
2017-09-25 14:41:22 +02:00
committed by Sameer Agarwal
parent 4bea6d7a2d
commit 28b1147a1d
+6 -1
View File
@@ -50,7 +50,12 @@ double WallTimeInSeconds() {
return omp_get_wtime();
#else
#ifdef _WIN32
return static_cast<double>(std::time(NULL));
LARGE_INTEGER count;
LARGE_INTEGER frequency;
QueryPerformanceCounter(&count);
QueryPerformanceFrequency(&frequency);
return static_cast<double>(count.QuadPart) /
static_cast<double>(frequency.QuadPart);
#else
timeval time_val;
gettimeofday(&time_val, NULL);