"calib/cputime.h"
Header.The "calib/cputime.h"
header provides facilities for measuring
the CPU time usage of code regions.
typedef unsigned long calib_cpu_time_t;
The type used by CALIB to represent elapsed CPU time. This is in units of 1/100 of a second.
calib_cpu_time_t calib_get_cpu_time (void);
Returns the total elapsed CPU time consumed by the calling process (and all of its waited-for children, both user and system time).
calib_cpu_time_t calib_get_delta_cpu_time (calib_cpu_time_t * time_in_out);
Returns the delta CPU time since the previous measurement
*time_in_out
, while updating *time_in_out
to be the
current elapsed CPU time, where
time_in_out | points to a calib_cpu_time_t containing the previous
elapsed CPU time, and is updated to contain the current elapsed CPU time. |
void calib_convert_cpu_time (calib_cpu_time_t time, char * buf);
Convert CPU time into printable text, where:
time | is a CPU time (or delta CPU time); and |
buf | is a character buffer to receive the textual time in CPU seconds, to a resolution of 2 decimal places. |
void calib_convert_delta_cpu_time ( char * buf, calib_cpu_time_t * time_in_out);
Combines the functionality of calib_get_delta_cpu_time
and
calib_convert_cpm_time
, where:
buf | is a character buffer to receive the textual delta CPU time (in seconds, to 2 decimal places); and |
time_in_out | points to a calib_cpu_time_t containing the previous
elapsed CPU time, and is updated to contain the current elapsed CPU time. |