#include <source/toolbox/timers/Clock.h>
Static Public Member Functions | |
static void | initialize (clock_t &clock) |
static void | initialize (double &clock) |
static void | timestamp (clock_t &user, clock_t &sys, clock_t &wall) |
static void | timestamp (clock_t &user, clock_t &sys, double &wall) |
static double | getClockCycle () |
The return value from the call to times() can be used to compute elapsed wallclock time. Alternatively, one can use MPI_Wtime() if MPI libraries are included. Two methods are defined for accessing system time - one that has a clock_t struct argument for wallclock time (the non-MPI case) and one that has a double argument to record the value of MPI_Wtime().
Computing user/system/wallclock time with the times() function is performed as follows:
* struct tms buffer; * clock_t wtime_start = times(&buffer); * clock_t stime_start = buffer.tms_stime; * clock_t utime_start = buffer.tms_utime; * (do some computational work) * clock_t wtime_stop = times(&buffer); * clock_t stime_stop = buffer.tms_stime; * clock_t utime_stop = buffer.tms_utime; * double wall_time = double(wtime_stop-wtime_start)/double(CLK_TCK); * double user_time = double(utime_stop-utime_start)/double(CLK_TCK); * double sys_time = double(stime_stop-stime_start)/double(CLK_TCK); *
void SAMRAI::tbox::Clock::initialize | ( | clock_t & | clock | ) | [static] |
Initialize system clock. Argument must be in the "clock_t" format which is a standard POSIX struct provided on most systems in the <sys/times.h> include file. On Microsoft systems, it is provided in <time.h>.
void SAMRAI::tbox::Clock::initialize | ( | double & | clock | ) | [static] |
Initialize system clock, where clock is in double format.
void SAMRAI::tbox::Clock::timestamp | ( | clock_t & | user, | |
clock_t & | sys, | |||
clock_t & | wall | |||
) | [static] |
Timestamp clocks for user, system, and wallclock times.
void SAMRAI::tbox::Clock::timestamp | ( | clock_t & | user, | |
clock_t & | sys, | |||
double & | wall | |||
) | [static] |
Timestamp user, system, and walltime clocks. Wallclock argument is in double format since it will access wallclock times from MPI_Wtime() function.
double SAMRAI::tbox::Clock::getClockCycle | ( | ) | [static] |
Returns clock cycle for the system.