]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix a bug in the Windows CPU time calculation. 5049/head
authorDavid Wells <wellsd2@rpi.edu>
Sat, 9 Sep 2017 02:11:10 +0000 (22:11 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Sat, 9 Sep 2017 02:22:34 +0000 (22:22 -0400)
The function GetProcessTImes() returns a value in units of 100 nanoseconds, so
we were previously off by a factor of 10.

include/deal.II/base/timer.h
source/base/timer.cc

index 8aa7bdbec81f76119f41c2815cfb064a4b056303..847c6af3eaedb5a2e737502ed1b722fd6eec24fe 100644 (file)
@@ -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
 {
index ab8825498d3382362d46f3af6be04974fa6cf79c..65fb9af71cd10152634eb0601e5a6521070bc008 100644 (file)
@@ -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)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.