From: bangerth Date: Mon, 28 Nov 2011 23:12:16 +0000 (+0000) Subject: Right-align wallclock time in TimerOutput. Reset original alignment flags at the... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2d5caa09596679dfb729cdf34b7f675c161a897;p=dealii-svn.git Right-align wallclock time in TimerOutput. Reset original alignment flags at the end of generating output. git-svn-id: https://svn.dealii.org/trunk@24776 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 2f578603f6..7cd09605fe 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -73,6 +73,12 @@ enabled due to a missing include file in file

Specific improvements

    +
  1. Fixed: The TimerOutput class set the alignment of output to right-aligned +under some circumstances, but didn't reset this to the previous value at the +end of output. This is now fixed. +
    +(Wolfgang Bangerth, 2011/11/28) +
  2. New: The copy constructor of the SparseMatrixEZ function now works (rather than throwing an exception) if the copied matrix has size zero. This is in accordance to the other matrix classes. diff --git a/deal.II/source/base/timer.cc b/deal.II/source/base/timer.cc index 0ecb790c32..26b916b81f 100644 --- a/deal.II/source/base/timer.cc +++ b/deal.II/source/base/timer.cc @@ -150,7 +150,7 @@ double Timer::operator() () const const double running_time = dtime - start_time + dtime_children - start_time_children + cumulative_time; - + if (Utilities::System::job_supports_mpi()) // in case of MPI, need to get the time // passed by summing the time over all @@ -369,8 +369,9 @@ TimerOutput::print_summary () const // precision and width of output // below. store the old values so we // can restore it later on - std::streamsize old_precision = out_stream.get_stream().precision (); - std::streamsize old_width = out_stream.get_stream().width (); + const std::istream::fmtflags old_flags = out_stream.get_stream().flags(); + const std::streamsize old_precision = out_stream.get_stream().precision (); + const std::streamsize old_width = out_stream.get_stream().width (); // in case we want to write CPU times if (output_type != wall_times) @@ -396,8 +397,7 @@ TimerOutput::print_summary () const << "+---------------------------------------------+------------" << "+------------+\n" << "| Total CPU time elapsed since start |"; - out_stream << std::setw(10); - out_stream << std::setprecision(3); + out_stream << std::setw(10) << std::setprecision(3) << std::right; out_stream << total_cpu_time << "s | |\n"; out_stream << "| | " << "| |\n"; @@ -464,8 +464,7 @@ TimerOutput::print_summary () const << "+---------------------------------------------+------------" << "+------------+\n" << "| Total wallclock time elapsed since start |"; - out_stream << std::setw(10); - out_stream << std::setprecision(3); + out_stream << std::setw(10) << std::setprecision(3) << std::right; out_stream << total_wall_time << "s | |\n"; out_stream << "| | " << "| |\n"; @@ -512,6 +511,7 @@ TimerOutput::print_summary () const // restore previous precision and width out_stream.get_stream().precision (old_precision); out_stream.get_stream().width (old_width); + out_stream.get_stream().flags (old_flags); }