CLOCK_GETCPUCLOCKID(3)

NAME
clock_getcpuclockid - get a clock measuring process CPU time

SYNOPSIS
#include <time.h>
int
clock_getcpuclockid(pid_t pid, clockid_t *clock_id);

DESCRIPTION
The clock_getcpuclockid() function allows the calling process to get a clockid_t value that measures the time spent by CPUs running in user or kernel mode on behalf of the process specified by pid. If pid is zero, then a clock for the calling process will be returned.

RETURN VALUES
If successful, clock_getcpuclockid() will return zero. Otherwise an error number will be returned to indicate the error.

ERRORS
clock_getcpuclockid() will fail if:

[EPERM]
    pid is neither zero nor the PID of the calling process.

SEE ALSO
clock_gettime(2), pthread_getcpuclockid(3)

STANDARDS
The clock_getcpuclockid() function conforms to p1003.1-2008.

HISTORY
The clock_getcpuclockid() function first appeared in IEEE Std 1003.1d-1999 (“POSIX.1d”) and has been available since OpenBSD 5.4.