# cpufrequtils vs ncpufreqd (or any other)

## i92guboj

Hello. 

This post is more aimed to satisfy my curiosity than to solve any real problem. 

Some days ago I was bored and looking around found that there are many different implementation for power saving daemons. I guess they all do more or less the same but I always have used cpufrequtils with the ondemand governor for no particular reason. I guess I just happened to stump on it when looking for power saving stuff years ago. 

So, I wanted to know what do people around use, and why. Does anyone know if there's any advantage in, let's say, using ncpufreqd, cpufreqd or any other over cpufrequtils? 

Cheers and thanks for any response.

----------

## solamour

I'm also using cpufrequtils, most likely because it was the one introduced in Gentoo Power Management Guide. It simply worked, so I never bothered to deal with something else.

http://www.gentoo.org/doc/en/power-management-guide.xml#doc_chap3

__

sol

----------

## i92guboj

Thanks, that guide is a good place to start researching.  :Smile: 

----------

## Gusar

I don't use any such daemons. I don't see the point. Ondemand does it's job just fine by itself. And if I ever need full performance, a simple script to change the governor is all that's needed.

----------

## Ant P.

A lot of those were written when cpu frequency changing was still new, and ondemand wasn't all that effective back then. Some of them integrate with acpi and the like to switch speed on battery/temperature events if you have a use for that sort of thing. ACPI takes care of overheating automatically though.

Ondemand is good enough for 99% of people nowadays (though I still have to set up my eee's cpufv control manually...)

----------

## Cyker

+1 for on demand!

----------

## DirtyHairy

I'm also on the ondemand boat without any userspace sugar on top, works great.

----------

## i92guboj

Great, keep suggestions coming. Thank you everyone  :Smile: 

----------

## Ormaaj

Cpufrequtils isn't a daemon. The only ones which are actual daemons are the so-called "userspace daemons" which make use of the userspace performance governor. (diagram). Otherwise no matter which you use, the governors themselves are kernel modules whose only function AFAICT is to dynamically adjust the ACPI p-states. With {performance, ondemand, conservative}, the algorithm which does the scaling is in the kernel and you're just picking a profile from the three, and with the userspace govenor, the algorithm is controled by the userspace daemon which instructs the cpufreq module how to scale in real time. The cpufreq-utils is just a frontend for querying and sending signals to sysfs to alter which of the in-kernel governor algorithms is in use from the default set during kernel config. (IMO it would make more sense to make this an eselect module rather than an initscript.)

For those with recent Intel chips running the "Intel idle" driver, it appears the CPU has additional control over (perhaps beyond) P-states. The i7z author recommends using no governor (or the performance governor which I think is equivalent to disabling cpu frequency scaling.) However my tests show that the CPU tends to not reach as deep of sleep states when using only the idle driver - which may or may not be a good thing. Since Intel recommends using the ondemand governor , and according to the kernel help documentation, intel_idle and ondemand are not mutually exclusive, I would recommend enabling both. I wouldn't recommend a userspace governor. It isn't necessary.

The one tweak I would recommend is setting sampling_down_factor to some value much greater than zero. I did some profiling under heavy load and kernel overhead is significantly reduced. Specifically, context switches reduced by around 95%.

https://forums.gentoo.org/viewtopic-p-6722257.html#6722257

----------

## Unrealized

I use ondemand governor and cpufrequtils.. It works fine on my box.

----------

## disi

Hmm, I experiment here a little. With i7z you actual get quiet different results than the system tells me with ondemand governor ^^

watching a movie:

```
Cpu speed from cpuinfo 2294.00Mhz

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) 2294 MHz

  CPU Multiplier 23x || Bus clock frequency (BCLK) 99.74 MHz

Socket [0] - [physical cores=4, logical cores=8, max online cores ever=4]

  TURBO ENABLED on 4 Cores, Hyper Threading ON

  True Frequency 2393.74 MHz (99.74 x [24])

  Max TURBO Multiplier (if Enabled) with 1/2/3/4 Cores is  34x/33x/31x/31x

  Current Frequency 990.46 MHz [99.74 x 9.93] (Max of below)

        Core [core-id]  :Actual Freq (Mult.)      C0%   Halt(C1)%  C3 %   C6 %   C7 %  Temp

        Core 1 [0]:       807.26 (8.09x)        12.5    15.9    3.02       1    75.7    45

        Core 2 [1]:       990.46 (9.93x)          10    8.66    1.03       1      85    42

        Core 3 [2]:       826.33 (8.28x)        4.21    3.29       1       1    93.2    48

        Core 4 [3]:       813.52 (8.16x)        3.59    8.72    2.82       1    86.2    44

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

[core-id] refers to core-id number in /proc/cpuinfo

'Garbage Values' message printed when garbage values are read

  Ctrl+C to exit

```

ripping a movie on one core:

```

Cpu speed from cpuinfo 2294.00Mhz

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) 2294 MHz

  CPU Multiplier 23x || Bus clock frequency (BCLK) 99.74 MHz

Socket [0] - [physical cores=4, logical cores=8, max online cores ever=4]

  TURBO ENABLED on 4 Cores, Hyper Threading ON

  True Frequency 2393.74 MHz (99.74 x [24])

  Max TURBO Multiplier (if Enabled) with 1/2/3/4 Cores is  34x/33x/31x/31x

  Current Frequency 3319.69 MHz [99.74 x 33.28] (Max of below)

        Core [core-id]  :Actual Freq (Mult.)      C0%   Halt(C1)%  C3 %   C6 %   C7 %  Temp

        Core 1 [0]:       3199.58 (32.08x)      3.35    29.3      12     1.7    52.4    53

        Core 2 [1]:       3319.69 (33.28x)      98.9       0       0       0       0    60

        Core 3 [2]:       3166.42 (31.75x)      1.38    7.22    2.19       1    87.7    55

        Core 4 [3]:       3130.44 (31.39x)         1    2.02       0       0    97.9    50

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

[core-id] refers to core-id number in /proc/cpuinfo

'Garbage Values' message printed when garbage values are read

  Ctrl+C to exit

```

Somebody knows what C7 does?

//edit:

 *Quote:*   

> Core C7 State
> 
> Individual threads of a core can enter the C7 state by initiating a P_LVL4 I/O read to
> 
> the P_BLK or by an MWAIT(C7) instruction. The core C7 state exhibits the same
> ...

 

google  link to pdf

----------

## Yamakuzure

As I am traveling twice each day on pt working on my notebook, I have cpufreqd installed which switches between "performance" (AC plugged in, temperature normal), "conservative" (AC not plugged in or temperature too high) and "powersave" (Battery below 30%) for me. As it is an i7 cpu in my notebook, I have enabled the intel_idle driver and battery lasts for something between three and five hours, depending on how many compilation cycles (I am a software developer) I need while on battery.

----------

