summaryrefslogtreecommitdiffstats
path: root/sys/kern/init_main.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/init_main.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/init_main.c')
-rw-r--r--sys/kern/init_main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 41b85e2..299acbe 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -514,6 +514,7 @@ proc0_post(void *dummy __unused)
struct timespec ts;
struct proc *p;
struct rusage ru;
+ struct thread *td;
/*
* Now we can look at the time, having had a chance to verify the
@@ -529,6 +530,9 @@ proc0_post(void *dummy __unused)
p->p_rux.rux_uticks = 0;
p->p_rux.rux_sticks = 0;
p->p_rux.rux_iticks = 0;
+ FOREACH_THREAD_IN_PROC(p, td) {
+ td->td_runtime = 0;
+ }
}
sx_sunlock(&allproc_lock);
PCPU_SET(switchtime, cpu_ticks());
OpenPOWER on IntegriCloud