On Wed, 23 Mar 2011, Stuart Henderson wrote:

On 2011/03/23 21:18, David Vasek wrote:
Hello all.

As majority of current hardware use some form of dynamic CPU
frequency scaling and it is frequently controlled by ampd, wouldn't
it be good to have the current hw.cpuspeed displayed somewhere in the
header lines of systat(1) and top(1)? Just to know the scale for
other performace figures on the display.

This sysctl isn't always available, I don't think it's useful
to print a bogus figure when it fails:

load averages:  1.93,  1.49,  1.35 /    0 MHz                         kaffir.spa
41 processes:  1 running, 39 idle, 1 on processor
CPU states: 98.2% user,  0.0% nice,  1.8% system,  0.0% interrupt,  0.0% idle
Memory: Real: 147M/196M act/tot  Free: 49M  Swap: 12M/600M used/tot

I had a simple check for greater-than-zero cpuspeed in the patch initially (and don't print anything otherwise), but I was not really sure if that could happen at all and on what archs. It definitly should be there. What architecture and CPU is this from? Btw, if there are any totally misleading values, shouldn't that be corrected by the kernel in the first place? But if the kernel doesn't know any better, I think zero from sysctl is ok. Just my opinion.

If you run some automated clock control (like apmd -C), you never know to what clock the cpu-time statistics in top(1) and systat(1) are related to. Does the CPU spend 30% of its time servising interrupts when it runs at 600 MHz, at 2.0 GHz, or at some other clock speed? Thirty percent of what? Without knowledge of the current clock frequency most of the figures would not give you good information.

And as Toby was alluding to, there may be systems where cores don't
all run at the same speed (or perhaps some aren't spun up at all); how
should this be handled? I imagine this will be an issue before having
to worry about the display formatting if CPUs exceed 9.999GHz.

I was not aware of such a possibility with the new generations of CPU's until now. I am still living in Pentium-M and Core2Duo era myself. It sounds to me as if SMP is not "symmetrical" anymore.

Anyway, HW_CPUSPEED is of type int, same as is HW_SETPERF. Not int[], only int. How could the individual cores be reported and controlled?

The other utilities, apmd(8) and apm(8) also set and report only single value given to them by sysctl. The little patch I sent at least helps one to see what value the kernel reports until some much more complex accomodation of individually scaled cores is done. It works well with single-core CPU's and traditional multi-core CPU's such as Core2Duo.

Regards,
David

Reply via email to