aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_proc.c
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2006-02-07 21:22:02 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2006-02-07 21:22:02 +0000
commit5b1a8eb397992f3b5992da7b26c999c410c9e5f0 (patch)
tree95918de865b5c6e707ecd4ce458d058d287406e9 /sys/kern/kern_proc.c
parent9bfe35c80d28ed1fcb74b0ecf0a812afeafed6b1 (diff)
downloadsrc-5b1a8eb397992f3b5992da7b26c999c410c9e5f0.tar.gz
src-5b1a8eb397992f3b5992da7b26c999c410c9e5f0.zip
Modify the way we account for CPU time spent (step 1)
Keep track of time spent by the cpu in various contexts in units of "cputicks" and scale to real-world microsec^H^H^H^H^H^H^H^Hclock_t only when somebody wants to inspect the numbers. For now "cputicks" are still derived from the current timecounter and therefore things should by definition remain sensible also on SMP machines. (The main reason for this first milestone commit is to verify that hypothesis.) On slower machines, the avoided multiplications to normalize timestams at every context switch, comes out as a 5-7% better score on the unixbench/context1 microbenchmark. On more modern hardware no change in performance is seen.
Notes
Notes: svn path=/head/; revision=155444
Diffstat (limited to 'sys/kern/kern_proc.c')
-rw-r--r--sys/kern/kern_proc.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index 59d257b4f89f..e02b947b3596 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -624,7 +624,6 @@ fill_kinfo_proc_only(struct proc *p, struct kinfo_proc *kp)
struct thread *td0;
struct tty *tp;
struct session *sp;
- struct timeval tv;
struct ucred *cred;
struct sigacts *ps;
@@ -695,8 +694,7 @@ fill_kinfo_proc_only(struct proc *p, struct kinfo_proc *kp)
kp->ki_swtime = p->p_swtime;
kp->ki_pid = p->p_pid;
kp->ki_nice = p->p_nice;
- bintime2timeval(&p->p_rux.rux_runtime, &tv);
- kp->ki_runtime = tv.tv_sec * (u_int64_t)1000000 + tv.tv_usec;
+ kp->ki_runtime = p->p_rux.rux_runtime * 1000000 / cpu_tickrate();
mtx_unlock_spin(&sched_lock);
if ((p->p_sflag & PS_INMEM) && p->p_stats != NULL) {
kp->ki_start = p->p_stats->p_start;