]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use last lap times for TimerOutput accumulation.
authorDavid Wells <wellsd2@rpi.edu>
Thu, 14 Sep 2017 18:22:22 +0000 (14:22 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Thu, 14 Sep 2017 18:22:22 +0000 (14:22 -0400)
The methods Timer::wall_time() and Timer::cpu_time() (i.e.,
Timer::operator()()) return cumulative times instead of times over the
last lap.

source/base/timer.cc

index fe1a58ac9442c4fb16a4a9366da5de0f7f24a496..39a685e41c082cb1b4f5b656833f649e0e46efb8 100644 (file)
@@ -431,13 +431,13 @@ TimerOutput::leave_subsection (const std::string &section_name)
 
   sections[actual_section_name].timer.stop();
   sections[actual_section_name].total_wall_time
-  += sections[actual_section_name].timer.wall_time();
+  += sections[actual_section_name].timer.last_wall_time();
 
   // Get cpu time. On MPI systems, if constructed with an mpi_communicator
   // like MPI_COMM_WORLD, then the Timer will sum up the CPU time between
   // processors among the provided mpi_communicator. Therefore, no
   // communication is needed here.
-  const double cpu_time = sections[actual_section_name].timer();
+  const double cpu_time = sections[actual_section_name].timer.last_cpu_time();
   sections[actual_section_name].total_cpu_time += cpu_time;
 
   // in case we have to print out something, do that here...
@@ -448,7 +448,7 @@ TimerOutput::leave_subsection (const std::string &section_name)
       std::ostringstream cpu;
       cpu << cpu_time << "s";
       std::ostringstream wall;
-      wall << sections[actual_section_name].timer.wall_time() << "s";
+      wall << sections[actual_section_name].timer.last_wall_time() << "s";
       if (output_type == cpu_times)
         output_time = ", CPU time: " + cpu.str();
       else if (output_type == wall_times)

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.