Timing Routines
To assist in performance measurements and profiling, several timing routines
are included in the Zoltan library. The main timer function,
Zoltan_Time,
provides access to at least two portable timers: one CPU clock and one
wall clock. On most systems, user time can also be measured.
A higher-level timing capability built using
Zoltan_Time is also available; see
ZOLTAN_TIMER for more
details.
The routines included in the utility are listed below.
Zoltan_Time: Returns the
time (in seconds) after some fixed reference point in time.
Zoltan_Time_Resolution:
The resolution of the specified timer.
Currently, the following timers are supported:
-
ZOLTAN_TIME_WALL : wall-clock time.
On most systems, this timer calls MPI_Wtime.
-
ZOLTAN_TIME_CPU : cpu time.
On most systems, this timer calls the ANSI C function clock(). Note
that this timer may roll over at just 71 minutes. Zoltan_Time
attempts to keep track of the number of roll-overs but this feature will
work only if Zoltan_Time is called at
least once during every period between roll-overs.
-
ZOLTAN_TIME_USER : user time.
On most systems, this timer calls times(). Note that times() is required
by POSIX and is widely available, but it is not required by ANSI C so may
be unavailable on some systems. Compile Zoltan with -DNO_TIMES in this
case.
Within Zoltan, it is recommended to select which timer to use by setting
the
TIMER general parameter
via Zoltan_Set_Param.
The default value of TIMER
is wall. Zoltan stores an integer representation of the selected
timing method in zz->Timer. This value should be passed to Zoltan_Time,
as in Zoltan_Time(zz->Timer).
double Zoltan_Time(int timer);
Zoltan_Time returns the time in seconds, measured from some fixed
reference time. Note that the time is not synchronized among different
processors or processes. The time may be either CPU time or wall-clock
time. The timer is selected through Zoltan_Set_Param.
Arguments: |
|
timer |
The timer type (e.g., wall or cpu) represented as an integer. See top
of page for a list of valid values. |
Returned Value: |
|
double |
The time in seconds. The time is always positive; a negative value
indicates an error. |
double Zoltan_Time_Resolution(int
timer) ;
Zoltan_Time_Resolution returns the resolution of the current
timer. The returned resolution is a lower bound on the actual resolution.
Arguments: |
|
timer |
The timer type (e.g., wall or cpu) represented as an integer. See top
of page for a list of valid values. |
Returned Value: |
|
double |
The timer resolution in seconds. If the resolution is unknown,
-1 is returned. |
Example:
Here is a simple example for how to use the timer routines:
double t0, t1, t2;
Zoltan_Set_Param(zz, "TIMER", "wall");
t0 = Zoltan_Time(zz->Timer);
/* code segment 1 */
t1 = Zoltan_Time(zz->Timer);
/* code segment 2 */
t2 = Zoltan_Time(zz->Timer);
/* Print timing results */
Zoltan_Print_Stats(zz->Communicator, zz->Debug_Proc, t1-t0, "Time
for part 1:");
Zoltan_Print_Stats(zz->Communicator, zz->Debug_Proc, t2-t1, "Time
for part 2:");
Zoltan_Print_Stats(zz->Communicator, zz->Debug_Proc, t2-t0, "Total
time :");
[Table of Contents | Next:
Debugging Services | Previous:
Hash Function | Privacy and Security]