summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorPaul Irofti <pirofti@cvs.openbsd.org>2012-04-12 14:59:20 +0000
committerPaul Irofti <pirofti@cvs.openbsd.org>2012-04-12 14:59:20 +0000
commitf63ee3a6ce91574448645ed33a0b6a1364e3afc5 (patch)
treeb8082a6a211be23de65284e8aa21285f859f73c3 /bin
parent22c2bfb88e8c394dc20c81832688dd203d02dd8b (diff)
Add per thread accounting, mainly for usage & friends.
This expands the already bloated FILL_KPROC macro to take an extra parameter that indicates if the callee is a thread or a process. The userland bits are adjusted accordingly and ps(1) and top(1) now display per thread usage times when -H is used. Also pkill(1) had to be adjusted so that duplicates don't pop up. libkvm does basically the same thing as the kernel bits. Okay guenther@.
Diffstat (limited to 'bin')
-rw-r--r--bin/ps/ps.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index e7edcc3895f..77a0e48f97f 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ps.c,v 1.52 2012/04/04 16:13:11 jsing Exp $ */
+/* $OpenBSD: ps.c,v 1.53 2012/04/12 14:59:19 pirofti Exp $ */
/* $NetBSD: ps.c,v 1.15 1995/05/18 20:33:25 mycroft Exp $ */
/*-
@@ -339,6 +339,10 @@ main(int argc, char *argv[])
if (xflg == 0 && ((int)kinfo[i]->p_tdev == NODEV ||
(kinfo[i]->p_flag & P_CONTROLT ) == 0))
continue;
+ if (!showthreads && kinfo[i]->p_tid != -1)
+ continue;
+ if (showthreads && kinfo[i]->p_tid == -1)
+ continue;
for (vent = vhead; vent; vent = vent->next) {
(vent->var->oproc)(kinfo[i], vent);
if (vent->next != NULL)