summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_proc.c
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2007-09-21 04:10:23 +0000
committerjeff <jeff@FreeBSD.org>2007-09-21 04:10:23 +0000
commitbc0eadb21d99ae42fb629bab36adfe6ac36c8ec2 (patch)
treeb0aa705537c625191bcfc8f15329374acc84160b /sys/kern/kern_proc.c
parent13d3160ef56965cf078529f5abb63d74e18d015a (diff)
downloadFreeBSD-src-bc0eadb21d99ae42fb629bab36adfe6ac36c8ec2.zip
FreeBSD-src-bc0eadb21d99ae42fb629bab36adfe6ac36c8ec2.tar.gz
- Redefine p_swtime and td_slptime as p_swtick and td_slptick. This
changes the units from seconds to the value of 'ticks' when swapped in/out. ULE does not have a periodic timer that scans all threads in the system and as such maintaining a per-second counter is difficult. - Change computations requiring the unit in seconds to subtract ticks and divide by hz. This does make the wraparound condition hz times more frequent but this is still in the range of several months to years and the adverse effects are minimal. Approved by: re
Diffstat (limited to 'sys/kern/kern_proc.c')
-rw-r--r--sys/kern/kern_proc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index bec9ee3..f75112f 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -694,7 +694,8 @@ fill_kinfo_proc_only(struct proc *p, struct kinfo_proc *kp)
kp->ki_sflag = PS_INMEM;
else
kp->ki_sflag = 0;
- kp->ki_swtime = p->p_swtime;
+ /* Calculate legacy swtime as seconds since 'swtick'. */
+ kp->ki_swtime = (ticks - p->p_swtick) / hz;
kp->ki_pid = p->p_pid;
kp->ki_nice = p->p_nice;
rufetch(p, &kp->ki_rusage);
@@ -812,7 +813,7 @@ fill_kinfo_thread(struct thread *td, struct kinfo_proc *kp)
kp->ki_kstack = (void *)td->td_kstack;
kp->ki_pctcpu = sched_pctcpu(td);
kp->ki_estcpu = td->td_estcpu;
- kp->ki_slptime = td->td_slptime;
+ kp->ki_slptime = (ticks - td->td_slptick) / hz;
kp->ki_pri.pri_class = td->td_pri_class;
kp->ki_pri.pri_user = td->td_user_pri;
OpenPOWER on IntegriCloud