summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_proc.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2011-07-18 17:33:08 +0000
committerjhb <jhb@FreeBSD.org>2011-07-18 17:33:08 +0000
commit4e1a6d0e6744fbd594114870804c3a5062815280 (patch)
treec9ca0ce831e01fabc0898005bf23fb41dcc1c5e9 /sys/kern/kern_proc.c
parent9a6ff5ad378cfaaa99c5162e2b0f6e4cb6a3c796 (diff)
downloadFreeBSD-src-4e1a6d0e6744fbd594114870804c3a5062815280.zip
FreeBSD-src-4e1a6d0e6744fbd594114870804c3a5062815280.tar.gz
- Export each thread's individual resource usage in in struct kinfo_proc's
ki_rusage member when KERN_PROC_INC_THREAD is passed to one of the process sysctls. - Correctly account for the current thread's cputime in the thread when doing the runtime fixup in calcru(). - Use TIDs as the key to lookup the previous thread to compute IO stat deltas in IO mode in top when thread display is enabled. Reviewed by: kib Approved by: re (kib)
Diffstat (limited to 'sys/kern/kern_proc.c')
-rw-r--r--sys/kern/kern_proc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index 4f1dc45..aac8b39 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -848,6 +848,8 @@ fill_kinfo_thread(struct thread *td, struct kinfo_proc *kp, int preferthread)
kp->ki_tdaddr = td;
PROC_LOCK_ASSERT(p, MA_OWNED);
+ if (preferthread)
+ PROC_SLOCK(p);
thread_lock(td);
if (td->td_wmesg != NULL)
strlcpy(kp->ki_wmesg, td->td_wmesg, sizeof(kp->ki_wmesg));
@@ -899,6 +901,7 @@ fill_kinfo_thread(struct thread *td, struct kinfo_proc *kp, int preferthread)
kp->ki_pri.pri_user = td->td_user_pri;
if (preferthread) {
+ rufetchtd(td, &kp->ki_rusage);
kp->ki_runtime = cputick2usec(td->td_rux.rux_runtime);
kp->ki_pctcpu = sched_pctcpu(td);
kp->ki_estcpu = td->td_estcpu;
@@ -911,6 +914,8 @@ fill_kinfo_thread(struct thread *td, struct kinfo_proc *kp, int preferthread)
kp->ki_siglist = td->td_siglist;
kp->ki_sigmask = td->td_sigmask;
thread_unlock(td);
+ if (preferthread)
+ PROC_SUNLOCK(p);
}
/*
OpenPOWER on IntegriCloud