term% cat index.txt CPUTIME(2) System Calls Manual CPUTIME(2)
NAME
cputime, times, cycles - cpu time in this process and children
SYNOPSIS
#include <u.h>
#include <libc.h>
int times(long t[4])
double cputime(void)
void cycles(uvlong *cyclep)
DESCRIPTION
If t is non-null, times fills it in with the number of milliseconds
spent in user code, system calls, child processes in user code, and
child processes in system calls. Cputime returns the sum of those same
times, converted to seconds. Times returns the elapsed real time, in
milliseconds, that the process has been running.
These functions read /dev/cputime, opening that file when they are
first called.
Cycles reads the processor's timestamp counter of cycles since reset,
if any, and stores it via cyclep. Currently supported architectures
are 386, amd64, and power; on all others, cycles will store zero.
SOURCE
/sys/src/libc/9sys
/sys/src/libc/*/cycles.[cs]
SEE ALSO
exec(2), cons(3)
BUGS
Only 386 processors starting with the Pentium have timestamp counters;
calling cycles on earlier processors may execute an illegal instrucā
tion.
CPUTIME(2)