View | Details | Raw Unified | Return to bug 246940 | Differences between
and this patch

Collapse All | Expand All

(-)sys/kern/kern_clock.c (-1 / +8 lines)
Lines 696-705 Link Here
696
{
696
{
697
697
698
	statclock_cnt(1, usermode);
698
	statclock_cnt(1, usermode);
699
}
699
}
700
700
701
static int cp_time_mode = 0;
702
SYSCTL_INT(_kern, OID_AUTO, cp_time_mode, CTLFLAG_RW, &cp_time_mode, 0,
703
    "Charge idle threads as: 0=user (default), 1=nice (server), 2=idle (desktop/mobile)");
704
701
void
705
void
702
statclock_cnt(int cnt, int usermode)
706
statclock_cnt(int cnt, int usermode)
703
{
707
{
704
	struct rusage *ru;
708
	struct rusage *ru;
705
	struct vmspace *vm;
709
	struct vmspace *vm;
Lines 715-725 Link Here
715
	if (usermode) {
719
	if (usermode) {
716
		/*
720
		/*
717
		 * Charge the time as appropriate.
721
		 * Charge the time as appropriate.
718
		 */
722
		 */
719
		td->td_uticks += cnt;
723
		td->td_uticks += cnt;
720
		if (p->p_nice > NZERO)
724
		if (cp_time_mode == 2 && td->td_pri_class == PRI_IDLE)
725
			cp_time[CP_IDLE] += cnt;
726
		else if (p->p_nice > NZERO ||
727
		   (cp_time_mode == 1 && td->td_pri_class == PRI_IDLE))
721
			cp_time[CP_NICE] += cnt;
728
			cp_time[CP_NICE] += cnt;
722
		else
729
		else
723
			cp_time[CP_USER] += cnt;
730
			cp_time[CP_USER] += cnt;
724
	} else {
731
	} else {
725
		/*
732
		/*

Return to bug 246940