From 878a009b6adf68d2775811aa704601c7f66c4c4c Mon Sep 17 00:00:00 2001 From: David Wells Date: Thu, 17 Aug 2017 00:56:49 -0400 Subject: [PATCH] Remove unused child (process) resource usage checks. 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 | 19 +++---------------- source/base/timer.cc | 22 +--------------------- 2 files changed, 4 insertions(+), 37 deletions(-) diff --git a/include/deal.II/base/timer.h b/include/deal.II/base/timer.h index dfc75325df..0e1e434f0b 100644 --- a/include/deal.II/base/timer.h +++ b/include/deal.II/base/timer.h @@ -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 - * getrusage(RUSAGE_CHILDREN,.) 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. diff --git a/source/base/timer.cc b/source/base/timer.cc index ab17fbcd98..4a2caecff8 100644 --- a/source/base/timer.cc +++ b/source/base/timer.cc @@ -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 -- 2.39.5