]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Improve documentation of timer class: we actually do sum up times of children.. Inclu...
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 25 Oct 2010 10:30:22 +0000 (10:30 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 25 Oct 2010 10:30:22 +0000 (10:30 +0000)
git-svn-id: https://svn.dealii.org/trunk@22472 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/timer.h

index 603ca9bc97ae505eae3d8071def780c7a0a22dd4..ab4783f1843bbd1f71ed211e5c0cf3067d7fd449 100644 (file)
 DEAL_II_NAMESPACE_OPEN
 
 /**
- * This is a very simple class which provides information about both the
- * CPU time and the wallclock time elapsed since the timer was started
- * last time. Information is retrieved from the system on the basis of
- * clock cycles since last time the computer was booted for the CPU
- * time.
+ * This is a very simple class which provides information about both the CPU
+ * time and the wallclock time elapsed since the timer was started last
+ * time. Information is retrieved from the system on the basis of clock cycles
+ * since last time the computer was booted for the CPU time. The wall time is
+ * based on the system clock accessed by @p gettimeofday, with a typical
+ * accuracy of 0.01 ms on linux systems.
  *
  *
  * <h3>Usage</h3>
@@ -41,7 +42,7 @@ DEAL_II_NAMESPACE_OPEN
  * Use of this class is as you might expect by looking at the member
  * functions:
  * @code
- *   Time timer;
+ *   Timer timer;
  *   timer.start ();
  *
  *   // do some complicated computations here
@@ -57,19 +58,17 @@ DEAL_II_NAMESPACE_OPEN
  * @endcode
  *
  * Alternatively, you can also restart the timer instead of resetting
- * it. The times between successive calls to start()/ stop() will then be
+ * it. The times between successive calls to start() / stop() will then be
  * accumulated. The usage of this class is also explained in the
  * step-12 and step-29 tutorial programs.
  *
- * @note Implementation of this class is system
- * dependent. Unfortunately, it does not work with multithreading
- * right now. In this case, we would like to sum up the time needed by
- * all children.
+ * @note Implementation of this class is system dependent. In case
+ * multithreaded routines (matrix-vector products, error estimators, etc.) are
+ * used, the CPU time is accumulated from all the children.
  *
  * @ingroup utilities
- * @author G. Kanschat, W. Bangerth
+ * @author G. Kanschat, W. Bangerth, M. Kronbichler
  */
-//TODO:[?] make class work with multithreading as well. better docs.
 class Timer
 {
   public:
@@ -143,6 +142,14 @@ class Timer
                                      */
     void reset ();
 
+                                    /**
+                                     * Resets the elapsed time to zero and
+                                     * starts the timer. This corresponds to
+                                     * calling @p reset() and @p start() on
+                                     * the Timer object.
+                                     */
+    void restart();
+
                                     /**
                                      * Access to the current CPU time
                                      * without disturbing time
@@ -234,6 +241,15 @@ class Timer
                                      */
     bool sync_wall_time;
 
+                                    /**
+                                     * A structure for parallel wall time
+                                     * measurement that includes the minimum
+                                     * time recorded among all processes, the
+                                     * maximum time as well as the average
+                                     * time defined as the sum of all
+                                     * individual times divided by the number
+                                     * of MPI processes in the MPI_Comm.
+                                     */
     Utilities::System::MinMaxAvg mpi_data;
 #endif
 };
@@ -512,6 +528,15 @@ class TimerOutput
 /* ---------------- inline functions ----------------- */
 
 
+inline
+void Timer::restart ()
+{
+  reset();
+  start();
+}
+
+
+
 #ifdef DEAL_II_COMPILER_SUPPORTS_MPI
 
 inline

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.