summaryrefslogtreecommitdiffstats
path: root/sys/kern/sched_ule.c
diff options
context:
space:
mode:
authorivoras <ivoras@FreeBSD.org>2009-11-24 19:57:41 +0000
committerivoras <ivoras@FreeBSD.org>2009-11-24 19:57:41 +0000
commit28bbcc383a103794b71efd69dac5dcb2fa92b46b (patch)
tree84430d2e063b6257af8044c86f800456591e288c /sys/kern/sched_ule.c
parent3f6a949df6ad4f20f6a53bddba1efa8cff98f2e0 (diff)
downloadFreeBSD-src-28bbcc383a103794b71efd69dac5dcb2fa92b46b.zip
FreeBSD-src-28bbcc383a103794b71efd69dac5dcb2fa92b46b.tar.gz
Make ULE process usage (%CPU) accounting usable again by keeping track
of the last tick we incremented on. Submitted by: matthew.fleming/at/isilon.com, is/at/rambler-co.ru Reviewed by: jeff (who thinks there should be a better way in the future) Approved by: gnn (mentor) MFC after: 3 weeks
Diffstat (limited to 'sys/kern/sched_ule.c')
-rw-r--r--sys/kern/sched_ule.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index 1ebfda2..5cd14f5 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -103,6 +103,7 @@ struct td_sched {
u_int ts_slptime; /* Number of ticks we vol. slept */
u_int ts_runtime; /* Number of ticks we were running */
int ts_ltick; /* Last tick that we were running on */
+ int ts_incrtick; /* Last tick that we incremented on */
int ts_ftick; /* First tick that we were running on */
int ts_ticks; /* Tick count */
#ifdef KTR
@@ -1991,6 +1992,7 @@ sched_fork_thread(struct thread *td, struct thread *child)
*/
ts2->ts_ticks = ts->ts_ticks;
ts2->ts_ltick = ts->ts_ltick;
+ ts2->ts_incrtick = ts->ts_incrtick;
ts2->ts_ftick = ts->ts_ftick;
child->td_user_pri = td->td_user_pri;
child->td_base_user_pri = td->td_base_user_pri;
@@ -2182,11 +2184,12 @@ sched_tick(void)
* Ticks is updated asynchronously on a single cpu. Check here to
* avoid incrementing ts_ticks multiple times in a single tick.
*/
- if (ts->ts_ltick == ticks)
+ if (ts->ts_incrtick == ticks)
return;
/* Adjust ticks for pctcpu */
ts->ts_ticks += 1 << SCHED_TICK_SHIFT;
ts->ts_ltick = ticks;
+ ts->ts_incrtick = ticks;
/*
* Update if we've exceeded our desired tick threshhold by over one
* second.
OpenPOWER on IntegriCloud