From: David Wells Date: Thu, 17 Aug 2017 16:46:11 +0000 (-0400) Subject: Rename some private Timer variables. X-Git-Tag: v9.0.0-rc1~1214^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4892%2Fhead;p=dealii.git Rename some private Timer variables. The new names are more descriptive, e.g., the CPU time variables did not mention that they measured CPU time. --- diff --git a/include/deal.II/base/timer.h b/include/deal.II/base/timer.h index af3c53354d..1c766e6278 100644 --- a/include/deal.II/base/timer.h +++ b/include/deal.II/base/timer.h @@ -196,28 +196,29 @@ public: private: /** - * 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. + * Amount of CPU time that the current process has used as of the last call + * to start(). Note that the constructor of this class calls the start() + * function. */ - double start_time; + double current_lap_starting_cpu_time; /** - * 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. + * Value of the wall time as of the last call to start(). Note that the + * constructor of this class calls the start() function. */ - double start_wall_time; + double current_lap_starting_wall_time; /** - * Accumulated time for all previous start()/stop() cycles. The time for the - * present cycle is not included. + * Accumulated CPU time for all previous start()/stop() cycles. The time for + * the present cycle is not included. */ - double cumulative_time; + double accumulated_cpu_time; /** * Accumulated wall time for all previous start()/stop() cycles. The wall * time for the present cycle is not included. */ - double cumulative_wall_time; + double accumulated_wall_time; /** * Wall time between the last start()/stop() cycle. diff --git a/source/base/timer.cc b/source/base/timer.cc index 4a2caecff8..e6e4348206 100644 --- a/source/base/timer.cc +++ b/source/base/timer.cc @@ -42,10 +42,10 @@ DEAL_II_NAMESPACE_OPEN // current process Timer::Timer() : - start_time (0.), - start_wall_time (0.), - cumulative_time (0.), - cumulative_wall_time (0.), + current_lap_starting_cpu_time (0.), + current_lap_starting_wall_time (0.), + accumulated_cpu_time (0.), + accumulated_wall_time (0.), last_lap_time (numbers::signaling_nan()), last_lap_cpu_time(numbers::signaling_nan()), running (false) @@ -73,10 +73,10 @@ Timer::Timer() Timer::Timer(MPI_Comm mpi_communicator, const bool sync_wall_time_) : - start_time (0.), - start_wall_time (0.), - cumulative_time (0.), - cumulative_wall_time (0.), + current_lap_starting_cpu_time (0.), + current_lap_starting_wall_time (0.), + accumulated_cpu_time (0.), + accumulated_wall_time (0.), last_lap_time (numbers::signaling_nan()), last_lap_cpu_time (numbers::signaling_nan()), running (false), @@ -146,15 +146,15 @@ void Timer::start () //namespace windows above struct timeval wall_timer; gettimeofday(&wall_timer, nullptr); - start_wall_time = wall_timer.tv_sec + 1.e-6 * wall_timer.tv_usec; + current_lap_starting_wall_time = wall_timer.tv_sec + 1.e-6 * wall_timer.tv_usec; rusage usage; getrusage (RUSAGE_SELF, &usage); - start_time = usage.ru_utime.tv_sec + 1.e-6 * usage.ru_utime.tv_usec; + current_lap_starting_cpu_time = usage.ru_utime.tv_sec + 1.e-6 * usage.ru_utime.tv_usec; #elif defined(DEAL_II_MSVC) - start_wall_time = windows::wall_clock(); - start_time = windows::cpu_clock(); + current_lap_starting_wall_time = windows::wall_clock(); + current_lap_starting_cpu_time = windows::cpu_clock(); #else # error Unsupported platform. Porting not finished. #endif @@ -174,15 +174,15 @@ double Timer::stop () rusage usage; getrusage (RUSAGE_SELF, &usage); const double dtime = usage.ru_utime.tv_sec + 1.e-6 * usage.ru_utime.tv_usec; - last_lap_cpu_time = dtime - start_time; + last_lap_cpu_time = dtime - current_lap_starting_cpu_time; struct timeval wall_timer; gettimeofday(&wall_timer, nullptr); last_lap_time = wall_timer.tv_sec + 1.e-6 * wall_timer.tv_usec - - start_wall_time; + - current_lap_starting_wall_time; #elif defined(DEAL_II_MSVC) - last_lap_time = windows::wall_clock() - start_wall_time; - last_lap_cpu_time = windows::cpu_clock() - start_time; + last_lap_time = windows::wall_clock() - current_lap_starting_wall_time; + last_lap_cpu_time = windows::cpu_clock() - current_lap_starting_cpu_time; #else # error Unsupported platform. Porting not finished. #endif @@ -196,16 +196,16 @@ double Timer::stop () last_lap_cpu_time = Utilities::MPI::min_max_avg (last_lap_cpu_time, mpi_communicator).max; } - cumulative_wall_time += last_lap_time; - cumulative_time += last_lap_cpu_time; - this->mpi_total_data = Utilities::MPI::min_max_avg (cumulative_wall_time, + accumulated_wall_time += last_lap_time; + accumulated_cpu_time += last_lap_cpu_time; + this->mpi_total_data = Utilities::MPI::min_max_avg (accumulated_wall_time, mpi_communicator); #else - cumulative_wall_time += last_lap_time; - cumulative_time += last_lap_cpu_time; + accumulated_wall_time += last_lap_time; + accumulated_cpu_time += last_lap_cpu_time; #endif } - return cumulative_time; + return accumulated_cpu_time; } @@ -218,7 +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; - const double running_time = dtime - start_time + cumulative_time; + const double running_time = dtime - current_lap_starting_cpu_time + accumulated_cpu_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 @@ -227,7 +227,7 @@ double Timer::cpu_time() const return Utilities::MPI::sum (running_time, mpi_communicator); #elif defined(DEAL_II_MSVC) - const double running_time = windows::cpu_clock() - start_time + cumulative_time; + const double running_time = windows::cpu_clock() - current_lap_starting_cpu_time + accumulated_cpu_time; return running_time; #else # error Unsupported platform. Porting not finished. @@ -235,7 +235,7 @@ double Timer::cpu_time() const } else { - return Utilities::MPI::sum (cumulative_time, mpi_communicator); + return Utilities::MPI::sum (accumulated_cpu_time, mpi_communicator); } } @@ -271,15 +271,15 @@ double Timer::wall_time () const gettimeofday(&wall_timer, nullptr); return (wall_timer.tv_sec + 1.e-6 * wall_timer.tv_usec - - start_wall_time - + cumulative_wall_time); + - current_lap_starting_wall_time + + accumulated_wall_time); #else //TODO[BG]: Do something useful here return 0; #endif } else - return cumulative_wall_time; + return accumulated_wall_time; } @@ -295,8 +295,8 @@ void Timer::reset () { last_lap_time = numbers::signaling_nan(); last_lap_cpu_time = numbers::signaling_nan(); - cumulative_time = 0.; - cumulative_wall_time = 0.; + accumulated_cpu_time = 0.; + accumulated_wall_time = 0.; running = false; #ifdef DEAL_II_WITH_MPI mpi_data.sum = mpi_data.min = mpi_data.max = mpi_data.avg = numbers::signaling_nan();