# Proper overclocked Nehalem/i7 stat reporting

## Ormaaj

Looks like someone finally figured out how to display correct frequencies, considering multipliers, turboboost, and c-states with overclocked i7s.

http://code.google.com/p/i7z/

Sample output on my box:

```
Cpu speed from cpuinfo 3810.45Mhz

cpuinfo might be wrong if cpufreq is enabled. To guess correctly try estimating via tsc

Linux's inbuilt cpu_khz code emulated now

True Frequency (without accounting Turbo) 3810.000000

CPU Multiplier 20x || Bus clock frequency (BCLK) 190.500000 MHz

TURBO DISABLED on 8 Cores

True Frequency 381.00 MHz

Max TURBO (if Enabled) with 1,2 Core  22x

Max TURBO (if Enabled) with 3,4 Cores 21x

Max TURBO (if Enabled) with 5,6 Cores 21x

Max TURBO (if Enabled) with 7,8 Cores 21x

Current Freqs

True Frequency 3809.40 MHz (Intel specifies largest of below to be running Freq)

        Processor  :Actual Freq (Mult.) C0% Halt(C1) %    C3 %   C6 %

        Processor 0:  3805.50 (19.98x)  14.9    85.1       0    74.1

        Processor 1:  3805.41 (19.98x)  20.1      80       0      33

        Processor 2:  3809.40 (20.00x)  70.8    29.2       0    8.57

        Processor 3:  3796.20 (19.93x)  15.2    84.9       0    59.8

C0 = Processor running without halting

C1 = Processor running with halts (States >C0 are power saver)

C3 = Cores running with PLL turned off and core cache turned off

C6 = Everything in C3 + core state saved to last level cache

  Above values in table are in percentage over the last 1 sec

 Total cores seen [8] (to OS)   [8] (to process)

 Total physical cores [4], Total Sockets [1]

  Ctrl+C to exit
```

This info will be nice to send to conky. I haven't tested it with cpufreq yet, but it would be very interesting if it works.

I'll see about writing an ebuild if anyone else finds this useful.

----------

## DigitalCorpus

Will this code work with Core2's or is this a BIOS limitation when it turns off frequency scaling?

----------

## Ormaaj

 *DigitalCorpus wrote:*   

> Will this code work with Core2's or is this a BIOS limitation when it turns off frequency scaling?

 When you turn off frequency scaling, the kernel will ignore your FSB or BCLK and assume its set to the default. This program looks pretty generic so I assume it would probably work on core2s. The thing which further complicates things for i7 is the "turbo boost" which the kernel can't figure out either, I think because the highest multiplier plus those which can only be achieved with turbo boost all share the same P-state, and so it can't be determined through ACPI.

The thing which makes this program different is that it figures out your FSB/BCLK and true CPU frequency, and then just divides to figure out what your multiplier should be given those numbers. I tested both with and without cpufreq, and it seems that both P and C-states do actually work properly on i7! You would never be able to know that otherwise. If you look at powertop with cpufreq compiled in your kernel you will see that P-states are indeed shown, and also according to this program, you get further down-clocking when your CPU is idle than you otherwise would with just sleep states. That's a very good thing because if thats correct it means you can overclock (and more importantly, over-volt) as much as you want without worrying too much about power.

My only remaining issue is that my hardware monitoring chip module (Winbond W83667HG) doesn't load with any kernel, so I still can't tell whether voltages are being scaled. They should be.

----------

## durian

Nice one.

I was also thinking about conky. :)

Just for fun, my output on a bog standard i920:

```
Cpu speed from cpuinfo 2672.57Mhz

cpuinfo might be wrong if cpufreq is enabled. To guess correctly try estimating via

Linux's inbuilt cpu_khz code emulated now

True Frequency (without accounting Turbo) 2672.000000

CPU Multiplier 20x || Bus clock frequency (BCLK) 133.600006 MHz

TURBO ENABLED on 8 Cores

True Frequency 2805.60 MHz

Max TURBO (if Enabled) with 1,2 Core  22x

Max TURBO (if Enabled) with 3,4 Cores 21x

Max TURBO (if Enabled) with 5,6 Cores 21x

Max TURBO (if Enabled) with 7,8 Cores 21x

Current Freqs

True Frequency 2720.95 MHz (Intel specifies largest of below to be running Freq)

        Processor  :Actual Freq (Mult.) C0% Halt(C1) %    C3 %   C6 %

        Processor 0:  1648.22 (12.34x)     1     100       0       0

        Processor 1:  2472.53 (18.51x)     1    99.8       0       0

        Processor 2:  2720.95 (20.37x)  2.47    97.5       0       0

        Processor 3:  1603.49 (12.00x)     0     100       0       0

C0 = Processor running without halting

C1 = Processor running with halts (States >C0 are power saver)

C3 = Cores running with PLL turned off and core cache turned off

C6 = Everything in C3 + core state saved to last level cache

  Above values in table are in percentage over the last 1 sec

 Total cores seen [8] (to OS)   [8] (to process)

 Total physical cores [4], Total Sockets [1]

```

The last two columns are always 0 on my system.

-peter

----------

