mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 16:40:38 +08:00
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:
committed by
Sameer Agarwal
parent
4bea6d7a2d
commit
28b1147a1d
@@ -50,7 +50,12 @@ double WallTimeInSeconds() {
|
|||||||
return omp_get_wtime();
|
return omp_get_wtime();
|
||||||
#else
|
#else
|
||||||
#ifdef _WIN32
|
#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
|
#else
|
||||||
timeval time_val;
|
timeval time_val;
|
||||||
gettimeofday(&time_val, NULL);
|
gettimeofday(&time_val, NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user