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.
// 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<double>()),
last_lap_cpu_time(numbers::signaling_nan<double>()),
running (false)
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<double>()),
last_lap_cpu_time (numbers::signaling_nan<double>()),
running (false),
//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
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
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;
}
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
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.
}
else
{
- return Utilities::MPI::sum (cumulative_time, mpi_communicator);
+ return Utilities::MPI::sum (accumulated_cpu_time, mpi_communicator);
}
}
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;
}
{
last_lap_time = numbers::signaling_nan<double>();
last_lap_cpu_time = numbers::signaling_nan<double>();
- 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<double>();