summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/uthread
diff options
context:
space:
mode:
authord <d@openbsd.org>1998-12-21 07:41:31 +0000
committerd <d@openbsd.org>1998-12-21 07:41:31 +0000
commita6f751ebf230ac86fd0b8b76dd4cebb1fe3a5137 (patch)
tree28bd6f56d2160df1f572f273ac65d50cbe0369ab /lib/libpthread/uthread
parentmemory leak (diff)
downloadwireguard-openbsd-a6f751ebf230ac86fd0b8b76dd4cebb1fe3a5137.tar.xz
wireguard-openbsd-a6f751ebf230ac86fd0b8b76dd4cebb1fe3a5137.zip
resource accounting
Diffstat (limited to 'lib/libpthread/uthread')
-rw-r--r--lib/libpthread/uthread/pthread_private.h6
-rw-r--r--lib/libpthread/uthread/uthread_create.c2
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/libpthread/uthread/pthread_private.h b/lib/libpthread/uthread/pthread_private.h
index 96d53c36d4e..d562003026a 100644
--- a/lib/libpthread/uthread/pthread_private.h
+++ b/lib/libpthread/uthread/pthread_private.h
@@ -383,6 +383,12 @@ struct pthread {
long slice_usec;
/*
+ * Cumulative times spent in thread
+ */
+ struct timeval ru_utime;
+ struct timeval ru_stime;
+
+ /*
* Incremental priority accumulated by thread while it is ready to
* run but is denied being run.
*/
diff --git a/lib/libpthread/uthread/uthread_create.c b/lib/libpthread/uthread/uthread_create.c
index ce70db0b3d4..4ce34434f3e 100644
--- a/lib/libpthread/uthread/uthread_create.c
+++ b/lib/libpthread/uthread/uthread_create.c
@@ -88,6 +88,8 @@ pthread_create(pthread_t * thread, const pthread_attr_t * attr,
new_thread->stack = stack;
new_thread->start_routine = start_routine;
new_thread->arg = arg;
+ timerclear(&new_thread->ru_utime);
+ timerclear(&new_thread->ru_stime);
/*
* Write a magic value to the thread structure