DIPlib Documentation - ©1995-2017 Quantitative Imaging Group, Delft University of Technology.

TimerGet

Timing functions

SYNOPSIS

#include "dip_timer.h"

dip_Error dip_TimerGet ( timer )

FUNCTION

This function gets three timer values elapsed since the last call to TimerSet.

The dip_Timer struct contains the following values:

Data typeNameDescription
dip_intsetTimeTime stamp when TimerSet was called.
dip_intgetTimeTime stamp when TimerGet was called.
dip_floatgetClockTimeAmount of CPU time (in seconds) between TimerSet and TimerGet.
dip_floatgetSystemTimeAmount of CPU time (in seconds) executing system calls in the process.
dip_floatgetUserTimeAmount of CPU time (in seconds) executing instructions in the process.
dip_floatsetClockTimeSet by TimerSet, just ignore!
dip_floatsetSystemTimeSet by TimerSet, just ignore!
dip_floatsetUserTimeSet 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.

ARGUMENTS

Data typeNameDescription
dip_Timer *timerPointer to a dip_Timer struct

NOTES

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.

SEE ALSO

TimerSet