From b6f3e31e278c65a6bb2b15fb03e3491563618a96 Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Tue, 12 Jun 2018 22:44:50 +0200 Subject: [PATCH] minor cleanup --- doc/news/changes/minor/20180529DenisDavydov_b | 2 +- source/base/timer.cc | 93 ++++++------------- 2 files changed, 27 insertions(+), 68 deletions(-) diff --git a/doc/news/changes/minor/20180529DenisDavydov_b b/doc/news/changes/minor/20180529DenisDavydov_b index 8cddb375ec..aed99f6136 100644 --- a/doc/news/changes/minor/20180529DenisDavydov_b +++ b/doc/news/changes/minor/20180529DenisDavydov_b @@ -1,4 +1,4 @@ New: TimerOutput::cpu_and_wall_times_grouped will print CPU and -wallclock time in the a single table. +wallclock time in a single table.
(Denis Davydov 2018/05/29) diff --git a/source/base/timer.cc b/source/base/timer.cc index df1b6505ec..2aeb758427 100644 --- a/source/base/timer.cc +++ b/source/base/timer.cc @@ -730,6 +730,7 @@ TimerOutput::print_summary() const } } else + // output_type == cpu_and_wall_times_grouped { const double total_wall_time = timer_all.wall_time(); double total_cpu_time = @@ -750,64 +751,27 @@ TimerOutput::print_summary() const // generate a nice table out_stream << "\n\n+---------------------------------------------" - << extra_dash << "+"; - - if (output_type != wall_times) - out_stream << "------------+------------+"; - - if (output_type != cpu_times) - out_stream << "------------+------------+"; - - out_stream << "\n"; - - if (output_type == cpu_times) - out_stream << "| Total CPU time elapsed since start "; - else if (output_type == wall_times) - out_stream << "| Total wallclock time elapsed since start "; - else - out_stream << "| Total CPU/wall time elapsed since start "; - - out_stream << extra_space << "|"; - - if (output_type != wall_times) - out_stream << std::setw(10) << std::setprecision(3) << std::right - << total_cpu_time << "s | |"; - - if (output_type != cpu_times) - out_stream << std::setw(10) << std::setprecision(3) << std::right - << total_wall_time << "s | |"; - - out_stream << "\n| " - << extra_space << "|"; - - if (output_type != wall_times) - out_stream << " | |"; - - if (output_type != cpu_times) - out_stream << " | |"; - - out_stream << "\n| Section " << extra_space - << "| no. calls |"; - - // FIXME: do we need this? - out_stream << std::setw(10) << std::setprecision(3); - - if (output_type != wall_times) - out_stream << " CPU time | % of total |"; - - if (output_type != cpu_times) - out_stream << " wall time | % of total |"; - - out_stream << "\n+---------------------------------" << extra_dash - << "+-----------+"; - - if (output_type != wall_times) - out_stream << "------------+------------+"; - - if (output_type != cpu_times) - out_stream << "------------+------------+"; - - out_stream << std::endl; + << extra_dash << "+" + << "------------+------------+" + << "------------+------------+" + << "\n" + << "| Total CPU/wall time elapsed since start " + << extra_space << "|" << std::setw(10) << std::setprecision(3) + << std::right << total_cpu_time << "s | |" + << std::setw(10) << std::setprecision(3) << std::right + << total_wall_time << "s | |" + << "\n| " + << extra_space << "|" + << " | |" + << " | |" + << "\n| Section " << extra_space + << "| no. calls |" << std::setw(10) << std::setprecision(3) + << " CPU time | % of total |" + << " wall time | % of total |" + << "\n+---------------------------------" << extra_dash + << "+-----------+" + << "------------+------------+" + << "------------+------------+" << std::endl; for (std::map::const_iterator i = sections.begin(); i != sections.end(); @@ -882,15 +846,10 @@ TimerOutput::print_summary() const } out_stream << "+---------------------------------" << extra_dash - << "+-----------+"; - - if (output_type != wall_times) - out_stream << "------------+------------+"; - - if (output_type != cpu_times) - out_stream << "------------+------------+"; - - out_stream << std::endl << std::endl; + << "+-----------+" + << "------------+------------+" + << "------------+------------+" << std::endl + << std::endl; if (output_type != wall_times && time_gap > 0.0) out_stream -- 2.39.5