From c0109dece26cf22a06b4facb0f11b1b0f4524ce6 Mon Sep 17 00:00:00 2001 From: scottl Date: Sun, 2 Feb 2003 08:24:32 +0000 Subject: [PATCH] Use hz if stathz is zero. Adopted from sched_4bsd. --- sys/kern/sched_ule.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 3ad61d6a52dc..88b1a4722f92 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -710,8 +710,10 @@ fixpt_t sched_pctcpu(struct kse *ke) { fixpt_t pctcpu; + int realstathz; pctcpu = 0; + realstathz = stathz ? stathz : hz; if (ke->ke_ticks) { int rtick; @@ -722,7 +724,7 @@ sched_pctcpu(struct kse *ke) /* How many rtick per second ? */ rtick = ke->ke_ticks / (SCHED_CPU_TIME * 10000); - pctcpu = (FSCALE * ((FSCALE * rtick)/stathz)) >> FSHIFT; + pctcpu = (FSCALE * ((FSCALE * rtick)/realstathz)) >> FSHIFT; } ke->ke_proc->p_swtime = ke->ke_ltick - ke->ke_ftick;