From: heister Date: Fri, 12 Jul 2013 18:25:01 +0000 (+0000) Subject: add some timing to step-40 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0dca9114ef30b9ff1913a330ca09e3eeb94410f5;p=dealii-svn.git add some timing to step-40 git-svn-id: https://svn.dealii.org/trunk@29986 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-40/step-40.cc b/deal.II/examples/step-40/step-40.cc index d8e45fc63a..15b0ce31e5 100644 --- a/deal.II/examples/step-40/step-40.cc +++ b/deal.II/examples/step-40/step-40.cc @@ -18,6 +18,7 @@ // already be familiar friends: #include #include +#include #include #include #include @@ -150,6 +151,7 @@ namespace Step40 PETScWrappers::MPI::Vector system_rhs; ConditionalOStream pcout; + TimerOutput computing_timer; }; @@ -175,8 +177,11 @@ namespace Step40 fe (2), pcout (std::cout, (Utilities::MPI::this_mpi_process(mpi_communicator) - == 0)) - {} + == 0)), + computing_timer (pcout, + TimerOutput::summary, + TimerOutput::wall_times) + {} @@ -206,6 +211,8 @@ namespace Step40 template void LaplaceProblem::setup_system () { + TimerOutput::Scope t(computing_timer, "setup"); + dof_handler.distribute_dofs (fe); // The next two lines extract some informatino we will need later on, @@ -334,6 +341,8 @@ namespace Step40 template void LaplaceProblem::assemble_system () { + TimerOutput::Scope t(computing_timer, "assembly"); + const QGauss quadrature_formula(3); FEValues fe_values (fe, quadrature_formula, @@ -428,6 +437,7 @@ namespace Step40 template void LaplaceProblem::solve () { + TimerOutput::Scope t(computing_timer, "solve"); PETScWrappers::MPI::Vector completely_distributed_solution (mpi_communicator, dof_handler.n_dofs(), @@ -473,6 +483,8 @@ namespace Step40 template void LaplaceProblem::refine_grid () { + TimerOutput::Scope t(computing_timer, "refine"); + Vector estimated_error_per_cell (triangulation.n_active_cells()); KellyErrorEstimator::estimate (dof_handler, QGauss(3), @@ -620,10 +632,16 @@ namespace Step40 solve (); if (Utilities::MPI::n_mpi_processes(mpi_communicator) <= 32) - output_results (cycle); - + { + TimerOutput::Scope t(computing_timer, "output"); + output_results (cycle); + } + pcout << std::endl; + computing_timer.print_summary (); + computing_timer.reset (); } + } }