Timing functions
#include "dip_timer.h"
dip_Error dip_TimerGet ( timer )
This function gets three timer values elapsed since the last call to TimerSet.
The dip_Timer struct contains the following values:
Data type | Name | Description |
dip_int | setTime | Time stamp when TimerSet was called. |
dip_int | getTime | Time stamp when TimerGet was called. |
dip_float | getClockTime | Amount of CPU time (in seconds) between TimerSet and TimerGet. |
dip_float | getSystemTime | Amount of CPU time (in seconds) executing system calls in the process. |
dip_float | getUserTime | Amount of CPU time (in seconds) executing instructions in the process. |
dip_float | setClockTime | Set by TimerSet, just ignore! |
dip_float | setSystemTime | Set by TimerSet, just ignore! |
dip_float | setUserTime | Set by TimerSet, just ignore! |
setTime and getTime give the time, in seconds, elapsed since the Epoch (00:00:00 UTC, January 1, 1970). The C function ctime can convert this value into a date string.
getClockTime gives the CPU time, in seconds, between the call to TimerSet and TimerGet. The number of significant digits depends on your system. getUserTime contains the portion of this time that was used by the CPU to process instructions for the current process. getSystemTime contains the portion of time spent in the system while executing tasks on behalf of the current process (e.g. doing file I/O). getUserTime and getSystemTime do not necessarily add up to getClockTime if there are other processes running on the same processor.
Data type | Name | Description |
dip_Timer * | timer | Pointer to a dip_Timer struct |
Note that getClockTime, getUserTime and getSystemTime can wrap around. The system returns these values as a clock_t value. If this is a 32-bit integer, these timers wrap around after only 72 minutes.
getUserTime and getSystemTime are not supported on some systems, it is possible that these values are always 0.