1.\" $OpenBSD: clock_getcpuclockid.3,v 1.3 2015/01/15 19:26:27 schwarze Exp $ 2.\" 3.\" Copyright (c) 2013 Philip Guenther <guenther@openbsd.org> 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.Dd $Mdocdate: January 15 2015 $ 18.Dt CLOCK_GETCPUCLOCKID 3 19.Os 20.Sh NAME 21.Nm clock_getcpuclockid 22.Nd get a clock measuring process CPU time 23.Sh SYNOPSIS 24.In time.h 25.Ft int 26.Fn clock_getcpuclockid "pid_t pid" "clockid_t *clock_id" 27.Sh DESCRIPTION 28The 29.Fn clock_getcpuclockid 30function allows the calling process to get a 31.Vt clockid_t 32value that measures the time spent by CPUs running in user or kernel mode 33on behalf of the process specified by 34.Fa pid . 35If 36.Fa pid 37is zero, then a clock for the calling process will be returned. 38.Sh RETURN VALUES 39If successful, 40.Fn clock_getcpuclockid 41will return zero. 42Otherwise an error number will be returned to indicate the error. 43.Sh ERRORS 44.Fn clock_getcpuclockid 45will fail if: 46.Bl -tag -width Er 47.It Bq Er EPERM 48.Fa pid 49is neither zero nor the PID of the calling process. 50.El 51.Sh SEE ALSO 52.Xr clock_gettime 2 , 53.Xr pthread_getcpuclockid 3 54.Sh STANDARDS 55The 56.Fn clock_getcpuclockid 57function conforms to 58.St -p1003.1-2008 . 59.Sh HISTORY 60The 61.Fn clock_getcpuclockid 62function first appeared in IEEE Std 1003.1d-1999 63.Pq Dq POSIX.1d 64and has been available since 65.Ox 5.4 . 66