]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Remove unused child (process) resource usage checks. 4884/head
authorDavid Wells <wellsd2@rpi.edu>
Thu, 17 Aug 2017 04:56:49 +0000 (00:56 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Thu, 17 Aug 2017 04:56:49 +0000 (00:56 -0400)
The option RUSAGE_CHILDREN (see man 2 getrusage) returns resource usage
statistics for terminated children of the current process. Since we don't use
this type of multiprocessing these values are always zero and we never needed to
measure them.

Reverts 5592e89cfa8.

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

index dfc75325dfdca7b05cb4318bd511249b46e46446..0e1e434f0bfa0b4ee100051e39f3247f90e0710a 100644 (file)
@@ -66,9 +66,9 @@ DEAL_II_NAMESPACE_OPEN
  * accumulated. The usage of this class is also explained in the step-28,
  * step-29 and step-30 tutorial programs.
  *
- * @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.
+ * @note Implementation of this class is system dependent. In particular, CPU
+ * times are accumulated from summing across all threads and will usually
+ * exceed the wall times.
  *
  * @ingroup utilities
  * @author G. Kanschat, W. Bangerth, M. Kronbichler
@@ -201,19 +201,6 @@ private:
    */
   double              start_time;
 
-
-  /**
-   * Similar to #start_time, but needed for children threads in multithread
-   * mode. Value of the user time when start() was called the last time or
-   * when the object was created and no stop() was issued in between.
-   *
-   * For some reason (error in operating system?) the function call
-   * <tt>getrusage(RUSAGE_CHILDREN,.)</tt> gives always 0 (at least on
-   * Solaris7). Hence the Timer class still does not yet work for
-   * multithreading mode.
-   */
-  double              start_time_children;
-
   /**
    * Value of the wall time when start() was called the last time or when the
    * object was created and no stop() was issued in between.
index ab17fbcd9830a1629fd4b6a2523ed6dfa95b3961..4a2caecff8e09646f6549b0985f1264da5b467ab 100644 (file)
@@ -43,7 +43,6 @@ DEAL_II_NAMESPACE_OPEN
 Timer::Timer()
   :
   start_time (0.),
-  start_time_children (0.),
   start_wall_time (0.),
   cumulative_time (0.),
   cumulative_wall_time (0.),
@@ -75,7 +74,6 @@ Timer::Timer(MPI_Comm mpi_communicator,
              const bool sync_wall_time_)
   :
   start_time (0.),
-  start_time_children (0.),
   start_wall_time (0.),
   cumulative_time (0.),
   cumulative_wall_time (0.),
@@ -154,14 +152,9 @@ void Timer::start ()
   getrusage (RUSAGE_SELF, &usage);
   start_time = usage.ru_utime.tv_sec + 1.e-6 * usage.ru_utime.tv_usec;
 
-  rusage usage_children;
-  getrusage (RUSAGE_CHILDREN, &usage_children);
-  start_time_children = usage_children.ru_utime.tv_sec + 1.e-6 * usage_children.ru_utime.tv_usec;
-
 #elif defined(DEAL_II_MSVC)
   start_wall_time = windows::wall_clock();
   start_time = windows::cpu_clock();
-  start_time_children = start_time;
 #else
 #  error Unsupported platform. Porting not finished.
 #endif
@@ -183,12 +176,6 @@ double Timer::stop ()
       const double dtime = usage.ru_utime.tv_sec + 1.e-6 * usage.ru_utime.tv_usec;
       last_lap_cpu_time = dtime - start_time;
 
-      rusage usage_children;
-      getrusage (RUSAGE_CHILDREN, &usage_children);
-      const double dtime_children =
-        usage_children.ru_utime.tv_sec + 1.e-6 * usage_children.ru_utime.tv_usec;
-      last_lap_cpu_time += dtime_children - start_time_children;
-
       struct timeval wall_timer;
       gettimeofday(&wall_timer, nullptr);
       last_lap_time = wall_timer.tv_sec + 1.e-6 * wall_timer.tv_usec
@@ -231,14 +218,7 @@ double Timer::cpu_time() const
       rusage usage;
       getrusage (RUSAGE_SELF, &usage);
       const double dtime =  usage.ru_utime.tv_sec + 1.e-6 * usage.ru_utime.tv_usec;
-
-      rusage usage_children;
-      getrusage (RUSAGE_CHILDREN, &usage_children);
-      const double dtime_children =
-        usage_children.ru_utime.tv_sec + 1.e-6 * usage_children.ru_utime.tv_usec;
-
-      const double running_time = dtime - start_time + dtime_children
-                                  - start_time_children + cumulative_time;
+      const double running_time = dtime - start_time + cumulative_time;
 
       // in case of MPI, need to get the time passed by summing the time over
       // all processes in the network. works also in case we just want to have

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.