From: David Wells Date: Sat, 9 Sep 2017 02:11:10 +0000 (-0400) Subject: Fix a bug in the Windows CPU time calculation. X-Git-Tag: v9.0.0-rc1~1104^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f0ec4e3bc0cdd0d4101245d34e77d5a36ac6a4e;p=dealii.git Fix a bug in the Windows CPU time calculation. The function GetProcessTImes() returns a value in units of 100 nanoseconds, so we were previously off by a factor of 10. --- diff --git a/include/deal.II/base/timer.h b/include/deal.II/base/timer.h index 8aa7bdbec8..847c6af3ea 100644 --- a/include/deal.II/base/timer.h +++ b/include/deal.II/base/timer.h @@ -37,8 +37,9 @@ DEAL_II_NAMESPACE_OPEN struct CPUClock { /** - * Duration type. Windows measures CPU times in units of 100 nanoseconds - * and POSIX uses microseconds, so go with microseconds for uniformity. + * Duration type. Windows measures CPU times, by default, in multiples of + * 1/64th of a second and and POSIX uses microseconds, so go with + * microseconds for uniformity. */ typedef std::chrono::microseconds duration; @@ -111,7 +112,7 @@ struct CPUClock * exceed the wall times. * * @ingroup utilities - * @author G. Kanschat, W. Bangerth, M. Kronbichler + * @author G. Kanschat, W. Bangerth, M. Kronbichler, D. Wells */ class Timer { diff --git a/source/base/timer.cc b/source/base/timer.cc index ab8825498d..65fb9af71c 100644 --- a/source/base/timer.cc +++ b/source/base/timer.cc @@ -114,7 +114,7 @@ CPUClock::time_point CPUClock::now() noexcept { system_cpu_duration = (double) (((unsigned long long)cpuTime.dwHighDateTime << 32) - | cpuTime.dwLowDateTime) / 1e6; + | cpuTime.dwLowDateTime) / 1e7; } // keep the zero value if GetProcessTimes didn't work #elif defined(DEAL_II_HAVE_SYS_RESOURCE_H)