diff options
Diffstat (limited to 'lib/libpthread')
-rw-r--r-- | lib/libpthread/include/pthread.h | 6 | ||||
-rw-r--r-- | lib/libpthread/man/Makefile.inc | 3 | ||||
-rw-r--r-- | lib/libpthread/man/pthread_getcpuclockid.3 | 61 | ||||
-rw-r--r-- | lib/libpthread/man/pthreads.3 | 7 |
4 files changed, 73 insertions, 4 deletions
diff --git a/lib/libpthread/include/pthread.h b/lib/libpthread/include/pthread.h index de6a8096483..7329429d750 100644 --- a/lib/libpthread/include/pthread.h +++ b/lib/libpthread/include/pthread.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pthread.h,v 1.39 2012/12/05 23:20:05 deraadt Exp $ */ +/* $OpenBSD: pthread.h,v 1.40 2013/06/17 19:11:54 guenther Exp $ */ /* * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu @@ -309,6 +309,10 @@ int pthread_spin_destroy(pthread_spinlock_t *); int pthread_spin_trylock(pthread_spinlock_t *); int pthread_spin_lock(pthread_spinlock_t *); int pthread_spin_unlock(pthread_spinlock_t *); + +#if __POSIX_VISIBLE >= 200112 +int pthread_getcpuclockid(pthread_t, clockid_t *); +#endif __END_DECLS #endif /* _PTHREAD_H_ */ diff --git a/lib/libpthread/man/Makefile.inc b/lib/libpthread/man/Makefile.inc index 80f85126f51..7fd3ba1dcd6 100644 --- a/lib/libpthread/man/Makefile.inc +++ b/lib/libpthread/man/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.33 2012/05/03 09:07:17 pirofti Exp $ +# $OpenBSD: Makefile.inc,v 1.34 2013/06/17 19:11:54 guenther Exp $ # $FreeBSD: Makefile.inc,v 1.6 1999/08/28 00:03:02 peter Exp $ # POSIX thread man files @@ -32,6 +32,7 @@ MAN+= \ pthread_equal.3 \ pthread_exit.3 \ pthread_getconcurrency.3 \ + pthread_getcpuclockid.3 \ pthread_getspecific.3 \ pthread_join.3 \ pthread_key_create.3 \ diff --git a/lib/libpthread/man/pthread_getcpuclockid.3 b/lib/libpthread/man/pthread_getcpuclockid.3 new file mode 100644 index 00000000000..b01ff49afda --- /dev/null +++ b/lib/libpthread/man/pthread_getcpuclockid.3 @@ -0,0 +1,61 @@ +.\" $OpenBSD: pthread_getcpuclockid.3,v 1.1 2013/06/17 19:11:54 guenther Exp $ +.\" +.\" Copyright (c) 2013 Philip Guenther <guenther@openbsd.org> +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd $Mdocdate: June 17 2013 $ +.Dt PTHREAD_GETCPUCLOCKID 3 +.Os +.Sh NAME +.Nm pthread_getcpuclockid +.Nd get a clock measuring thread CPU time +.Sh SYNOPSIS +.Fd #include <pthread.h> +.Ft int +.Fn pthread_getcpuclockid "pthread_t thread" "clockid_t *clock_id" +.Sh DESCRIPTION +The +.Fn pthread_getcpuclockid +function allows the calling thread to get a +.Vt clockid_t +value that measures the time spent by CPUs running in user or kernel mode +on behalf of the thread specified by +.Fa thread . +.Sh RETURN VALUES +If successful, +.Fn pthread_getcpuclockid +will return zero. +Otherwise an error number will be returned to indicate the error. +.Sh ERRORS +.Fn pthread_getcpuclockid +will fail if: +.Bl -tag -width Er +.It Bq Er ESRCH +thread is an invalid thread ID. +.El +.Sh SEE ALSO +.Xr clock_gettime 2 , +.Xr clock_getcpuclockid 3 +.Sh STANDARDS +The +.Fn pthread_getcpuclockid +function conforms to +.St -p1003.1-2008 . +.Sh HISTORY +The +.Fn pthread_getcpuclockid +function first appeared in +.St -p1003.1d-99 +and has been available since +.Ox 5.4 . diff --git a/lib/libpthread/man/pthreads.3 b/lib/libpthread/man/pthreads.3 index 9f76594d4ad..3843b8a1f3a 100644 --- a/lib/libpthread/man/pthreads.3 +++ b/lib/libpthread/man/pthreads.3 @@ -1,6 +1,6 @@ -.\" $OpenBSD: pthreads.3,v 1.38 2012/09/02 13:29:29 jmc Exp $ +.\" $OpenBSD: pthreads.3,v 1.39 2013/06/17 19:11:54 guenther Exp $ .\" David Leonard <d@openbsd.org>, 1998. Public domain. -.Dd $Mdocdate: September 2 2012 $ +.Dd $Mdocdate: June 17 2013 $ .Dt PTHREADS 3 .Os .Sh NAME @@ -269,6 +269,8 @@ Set cancelability state. Set cancelability state. .It Fn pthread_sigmask Examine/change a thread's signal mask. +.It Fn pthread_getcpuclockid +Get a CPU time clock for a thread. .El .Ss Thread stacks Each thread has a different stack, whether it be provided by a @@ -419,6 +421,7 @@ with larger numbers generating more verbose output. .Xr pthread_detach 3 , .Xr pthread_equal 3 , .Xr pthread_exit 3 , +.Xr pthread_getcpuclockid 3, .Xr pthread_getspecific 3 , .Xr pthread_join 3 , .Xr pthread_key_create 3 , |