From 0ed28880b0bc85a86767342cef9b548843cea08f Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Fri, 12 Jul 2013 18:25:01 +0000 Subject: [PATCH] add some timing to step-40 git-svn-id: https://svn.dealii.org/trunk@29986 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-40/step-40.cc | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) 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 (); } + } } -- 2.39.5