From ff0d152143f6c2fdc379264d53620cce96a8f7e2 Mon Sep 17 00:00:00 2001
From: Martin Schneider <martin.schneider@iws.uni-stuttgart.de>
Date: Mon, 2 Feb 2015 09:32:55 +0000
Subject: [PATCH] Added CPU time output for initialization, which is especially
 for stationary problems interesting.

Reviewed by Bernd

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@14160 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 dumux/common/timemanager.hh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/dumux/common/timemanager.hh b/dumux/common/timemanager.hh
index 3667e2bd4c..6164676dc3 100644
--- a/dumux/common/timemanager.hh
+++ b/dumux/common/timemanager.hh
@@ -105,6 +105,8 @@ public:
               Scalar tEnd,
               bool restart = false)
     {
+        timer_.reset();
+
         problem_ = &problem;
         time_ = tStart;
         timeStepSize_ = dtInitial;
@@ -129,6 +131,13 @@ public:
             time_ += timeStepSize_;
         }
 
+        if (verbose_) {
+            int numProcesses = Dune::MPIHelper::getCollectiveCommunication().size();
+            std::cout << "Initialization took " << timer_.elapsed() <<" seconds on "
+                      << numProcesses << " processes.\n"
+                      << "The cumulative CPU time was " << timer_.elapsed()*numProcesses << " seconds.\n";
+        }
+
     }
 
     /*!
-- 
GitLab