1.\"	$OpenBSD: pthread_getcpuclockid.3,v 1.3 2015/09/10 17:55:21 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: September 10 2015 $
18.Dt PTHREAD_GETCPUCLOCKID 3
19.Os
20.Sh NAME
21.Nm pthread_getcpuclockid
22.Nd get a clock measuring thread CPU time
23.Sh SYNOPSIS
24.In pthread.h
25.Ft int
26.Fn pthread_getcpuclockid "pthread_t thread" "clockid_t *clock_id"
27.Sh DESCRIPTION
28The
29.Fn pthread_getcpuclockid
30function allows the calling thread 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 thread specified by
34.Fa thread .
35.Sh RETURN VALUES
36If successful,
37.Fn pthread_getcpuclockid
38will return zero.
39Otherwise an error number will be returned to indicate the error.
40.Sh ERRORS
41.Fn pthread_getcpuclockid
42will fail if:
43.Bl -tag -width Er
44.It Bq Er ESRCH
45thread is an invalid thread ID.
46.El
47.Sh SEE ALSO
48.Xr clock_gettime 2 ,
49.Xr clock_getcpuclockid 3
50.Sh STANDARDS
51The
52.Fn pthread_getcpuclockid
53function conforms to
54.St -p1003.1-2008 .
55.Sh HISTORY
56The
57.Fn pthread_getcpuclockid
58function first appeared in IEEE Std 1003.1d-1999
59.Pq Dq POSIX.1d
60and has been available since
61.Ox 5.4 .
62