Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 May 2012 23:55:59 +0400
From:      Andrey Zonov <andrey@zonov.org>
To:        freebsd-stable <freebsd-stable@freebsd.org>
Subject:   powerd isn't correct count load
Message-ID:  <4FB4064F.2020601@zonov.org>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------000401070709000005020208
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I just ran powerd(8) in verbose mode and found that it isn't correct 
count load.

# powerd -v
powerd: unable to determine AC line status
load 323%, current freq 2409 MHz ( 0), wanted freq 4818 MHz
load 222%, current freq 2409 MHz ( 0), wanted freq 4818 MHz
load 213%, current freq 2409 MHz ( 0), wanted freq 4818 MHz
load 151%, current freq 2409 MHz ( 0), wanted freq 4818 MHz
load 170%, current freq 2409 MHz ( 0), wanted freq 4818 MHz

I think load should be divided by the number of CPUs.

Attached patch solves the problem.

-- 
Andrey Zonov

--------------000401070709000005020208
Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0";
	name="powerd.c.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="powerd.c.patch"

Index: usr.sbin/powerd/powerd.c
===================================================================
--- usr.sbin/powerd/powerd.c	(revision 235394)
+++ usr.sbin/powerd/powerd.c	(working copy)
@@ -168,6 +168,7 @@
 			*load += 100 - (cp_times[cpu * CPUSTATES + CP_IDLE] - 
 			    cp_times_old[cpu * CPUSTATES + CP_IDLE]) * 100 / total;
 		}
+		*load /= ncpus;
 	}
 
 	memcpy(cp_times_old, cp_times, cp_times_len);

--------------000401070709000005020208--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4FB4064F.2020601>