Page 1 of 1

Feature request: CPU C-states

Posted: Fri Apr 29, 2011 10:23 am
by koitsu
Something I've wanted for a very, very long time from Core Temp was the ability for it to show you processor C-states (both what's currently in use and what C-state capabilities each core has). I'm not talking about system sleep states, I'm talking about processor C-states:

http://en.wikipedia.org/wiki/Advanced_C ... sor_states

At this time, the only utility I know which provides this is RMClock, which has gone into remission and is generally an "ehhh" program anyway. Other tools like ThrottleStop don't provide this either. Remember, I'm not interested in adjusting C-state capability or what's enabled/disabled, I just want to know what's available and what the current state is. You can adjust C-state information per-core, but this isn't ideal (it's best to set it globally), though showing it for each core would probably be wisest.

Since this is a Win32 application, this may be of great help to the author since it discusses the ACPI-related Win32 API calls which are covered under the Power Management API (I used this myself to adjust power profiles on Windows via a command-line app I wrote, until someone told me about powercfg.exe). Below are highly relevant docs, and writing the code should not be difficult:

http://download.microsoft.com/download/ ... ontrol.doc

http://msdn.microsoft.com/en-us/library/bb968807

I'm quite familiar with configuration of FreeBSD and achieving use of both EIST/EST clock frequency throttling as well as making use of C-states, but I've always been saddened by the fact that Core Temp doesn't show me C-state info. :-( Would love for this to work itself in there...

Thanks!

Re: Feature request: CPU C-states

Posted: Sat Apr 30, 2011 9:18 am
by The Coolest
Very early versions of Core Temp did implement current C-state.
The problem is that your CPU must be in C0 to execute instructions, and therefore the program has always reported C0.
I may look into listing the highest C-state or something, but displaying the current one is problematic.

Re: Feature request: CPU C-states

Posted: Sun May 01, 2011 4:09 am
by koitsu
Yes you're right, I hadn't really thought about that :-). Here's how things are implemented on FreeBSD, which might help give you some ideas:

FreeBSD will show you all of the CPU C-states that are supported via the dev.cpu.X.cx_supported sysctl variables (where "X" represents each CPU core). The amount of time each C-state is in use is also tracked via the dev.cpu.X.cx_usage variables. The hw.acpi.cpu.cx_lowest sysctl defines what the lowest C-state is that the system will permit the processor to go into (handled via ACPI hints of course); setting this value trickles down into the dev.cpu.X.cx_lowest variables (so it lets you effectively set all the dev.cpu.X.cx_lowest variables at once).

For example, here are some sysctls on a Core 2 Duo E8400 system:

Code: Select all

hw.acpi.cpu.cx_lowest: C2
dev.cpu.0.cx_supported: C1/0 C2/85
dev.cpu.0.cx_lowest: C2
dev.cpu.0.cx_usage: 72.34% 27.65% last 94us
dev.cpu.1.cx_supported: C1/0 C2/85
dev.cpu.1.cx_lowest: C2
dev.cpu.1.cx_usage: 71.49% 28.50% last 84us
Official documentation:

Code: Select all

     hw.acpi.cpu.cx_lowest
             Lowest Cx state to use for idling the CPU.  A scheduling algo-
             rithm will select states between C1 and this setting as system
             load dictates.  To enable ACPI CPU idling control,
             machdep.cpu_idle_hlt must be set to 1.

Code: Select all

     hw.acpi.cpu.cx_supported
             List of supported CPU idle states and their transition latency in
             microseconds.  Each state has a type (e.g., C2).  C1 is equiva-
             lent to the ia32 HLT instruction, C2 provides a deeper sleep with
             the same semantics, and C3 provides the deepest sleep but addi-
             tionally requires bus mastering to be disabled.  States greater
             than C3 provide even more power savings with the same semantics
             as the C3 state.  Deeper sleeps provide more power savings but
             increased transition latency when an interrupt occurs.

Code: Select all

     hw.acpi.cpu.cx_usage
             Debugging information listing the percent of total usage for each
             sleep state.  The values are reset when hw.acpi.cpu.cx_lowest is
             modified.
EDIT: I hope this helps give you some ideas or some degree of assistance. I realised that Core Temp effectively can't do the C-state usage tracking (that should ultimately be done by the ACPI layer in WIndows), so, at least printing the C-states which are supported would be totally awesome.

Re: Feature request: CPU C-states

Posted: Sun May 01, 2011 8:15 am
by The Coolest
I'll consider adding that to the " System Information " portion of the program, since available C-states is not something that interests most users, and can even confuse some of the novice users.

Re: Feature request: CPU C-states

Posted: Sun May 01, 2011 6:47 pm
by koitsu
Understood, and completely acceptable. And I absolutely understand how it could confuse general users ("sleep state?!?! So when I shut my laptop off, does this affect hibernate?!?!" *sigh*) :-)

Thank you!