summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_resource.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2008-01-10 22:11:20 +0000
committerrwatson <rwatson@FreeBSD.org>2008-01-10 22:11:20 +0000
commitf261f9865b0f750ea6f3b27feebcf093412d9dbf (patch)
tree521eeaf16fcaaa04187cb36d5416f01065cdf9a3 /sys/kern/kern_resource.c
parent2fdbb8b316f250eccd5656acc19a211e94e5c7b3 (diff)
downloadFreeBSD-src-f261f9865b0f750ea6f3b27feebcf093412d9dbf.zip
FreeBSD-src-f261f9865b0f750ea6f3b27feebcf093412d9dbf.tar.gz
Don't zero td_runtime when billing thread CPU usage to the process;
maintain a separate td_incruntime to hold unbilled CPU usage for the thread that has the previous properties of td_runtime. When thread information is requested using the thread monitoring sysctls, export thread td_runtime instead of process rusage runtime in kinfo_proc. This restores the display of individual ithread and other kernel thread CPU usage since inception in ps -H and top -SH, as well for libthr user threads, valuable debugging information lost with the move to try kthreads since they are no longer independent processes. There is universal agreement that we should rewrite the process and thread export sysctls, but this commit gets things going a bit better in the mean time. Likewise, there are resevations about the continued validity of statclock given the speed of modern processors. Reviewed by: attilio, emaste, jhb, julian
Diffstat (limited to 'sys/kern/kern_resource.c')
-rw-r--r--sys/kern/kern_resource.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
index 4e22054..5f8ea8f 100644
--- a/sys/kern/kern_resource.c
+++ b/sys/kern/kern_resource.c
@@ -849,7 +849,7 @@ calcru(struct proc *p, struct timeval *up, struct timeval *sp)
}
/* Make sure the per-thread stats are current. */
FOREACH_THREAD_IN_PROC(p, td) {
- if (td->td_runtime == 0)
+ if (td->td_incruntime == 0)
continue;
thread_lock(td);
ruxagg(&p->p_rux, td);
@@ -1021,11 +1021,11 @@ ruxagg(struct rusage_ext *rux, struct thread *td)
THREAD_LOCK_ASSERT(td, MA_OWNED);
PROC_SLOCK_ASSERT(td->td_proc, MA_OWNED);
- rux->rux_runtime += td->td_runtime;
+ rux->rux_runtime += td->td_incruntime;
rux->rux_uticks += td->td_uticks;
rux->rux_sticks += td->td_sticks;
rux->rux_iticks += td->td_iticks;
- td->td_runtime = 0;
+ td->td_incruntime = 0;
td->td_uticks = 0;
td->td_iticks = 0;
td->td_sticks = 0;
OpenPOWER on IntegriCloud