HTML automatically generated with rman
Table of Contents


cputime, etime, dtime - routines to time your code


#include <stdinc.h>double cputime(void);double cputime2(int mode)float etime(float
*tarray);float dtime(float *tarray);


cputime returns the CPU time in minutes. cputime2 allows a mode to be passed, which time is requested. mode=0,1: user and sys time from times(2) , and mode=2 from clock(2) .

Two old FORTRAN routines, etime and dtime can be compiled into this code, if not available on the local system (-DETIME):

etime returns the elapsed runtime in seconds for the calling process.

dtime returns the elapsed time since the last call to dtime, or the start of execution on the first call. The returned argument tarray contains user time in the first element and system time in the second element. Elapsed time, the returned value, is the sum of user and system time.

See Also

timers(3NEMO) , times(2) , clock(2)


Peter Teuben


~/src/kernel/cores    cputime.c

Update History

28-aug-2012    finally documented    PJT
11-jul-2020    added cputime2(mode)    PJT

Table of Contents