FreeBSD/sys/kern/sched_ule.c
/*
 * Fetch cpu utilization information.  Updates on demand.
 */
Fetch cpu utilization information.  Updates on demand.
Fetch cpu utilization information . Updates on demand .
fixpt_t
sched_pctcpu(struct thread *td)
{
	fixpt_t pctcpu;
	struct td_sched *ts;
	pctcpu = 0;
	ts = td_get_sched(td);
	THREAD_LOCK_ASSERT(td, MA_OWNED);
	sched_pctcpu_update(ts, TD_IS_RUNNING(td));
	if (ts->ts_ticks) {
		int rtick;
		rtick = min(SCHED_TICK_HZ(ts) / SCHED_TICK_SECS, hz);
		pctcpu = (FSCALE * ((FSCALE * rtick)/hz)) >> FSHIFT;
	}
	return (pctcpu);
}
fixpt_t sched_pctcpu ( struct thread * td ) { fixpt_t pctcpu ; struct td_sched * ts ; pctcpu = 0 ; ts = td_get_sched ( td ) ; THREAD_LOCK_ASSERT ( td , MA_OWNED ) ; sched_pctcpu_update ( ts , TD_IS_RUNNING ( td ) ) ; if ( ts -> ts_ticks ) { int rtick ; rtick = min ( SCHED_TICK_HZ ( ts ) / SCHED_TICK_SECS , hz ) ; pctcpu = ( FSCALE * ( ( FSCALE * rtick ) / hz ) ) >> FSHIFT ; } return ( pctcpu ) ; }
Fetch cpu utilization information.
Fetch cpu utilization information .
/* How many rtick per second ? */