From e4e4b9e37f7f2ab1da8c8d7528ec4d81b292f538 Mon Sep 17 00:00:00 2001 From: David Wells Date: Thu, 14 Sep 2017 14:22:22 -0400 Subject: [PATCH] Use last lap times for TimerOutput accumulation. 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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/base/timer.cc b/source/base/timer.cc index fe1a58ac94..39a685e41c 100644 --- a/source/base/timer.cc +++ b/source/base/timer.cc @@ -431,13 +431,13 @@ TimerOutput::leave_subsection (const std::string §ion_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 §ion_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) -- 2.39.5