]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
add some timing to step-40
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 12 Jul 2013 18:25:01 +0000 (18:25 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 12 Jul 2013 18:25:01 +0000 (18:25 +0000)
git-svn-id: https://svn.dealii.org/trunk@29986 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-40/step-40.cc

index d8e45fc63a78ee7d43685a0ba2d68fa7b9ead06e..15b0ce31e5f85e58c9e10c365d9c8bf7f7c9162f 100644 (file)
@@ -18,6 +18,7 @@
 // already be familiar friends:
 #include <deal.II/base/quadrature_lib.h>
 #include <deal.II/base/function.h>
+#include <deal.II/base/timer.h>
 #include <deal.II/lac/vector.h>
 #include <deal.II/lac/full_matrix.h>
 #include <deal.II/lac/solver_cg.h>
@@ -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 <int dim>
   void LaplaceProblem<dim>::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 <int dim>
   void LaplaceProblem<dim>::assemble_system ()
   {
+    TimerOutput::Scope t(computing_timer, "assembly");
+
     const QGauss<dim>  quadrature_formula(3);
 
     FEValues<dim> fe_values (fe, quadrature_formula,
@@ -428,6 +437,7 @@ namespace Step40
   template <int dim>
   void LaplaceProblem<dim>::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 <int dim>
   void LaplaceProblem<dim>::refine_grid ()
   {
+    TimerOutput::Scope t(computing_timer, "refine");
+
     Vector<float> estimated_error_per_cell (triangulation.n_active_cells());
     KellyErrorEstimator<dim>::estimate (dof_handler,
                                         QGauss<dim-1>(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 ();
       }
+    
   }
 }
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.