You are not logged in.

#1 2009-01-18 09:24:17

Olnex
Member
Registered: 2008-04-10
Posts: 89

Script to scale CPU to powersave when on battery

Hello everyone, I need a script that scales CPU to powersave when on battery, scales back to performance on AC, can anyone give me the script or a guide which has information on this?
I found scripts in /etc/acpi/actions whichs seems to be doing the job, but I'm not sure.
Thanks a lot!

Offline

#2 2009-01-18 09:44:16

Olnex
Member
Registered: 2008-04-10
Posts: 89

Re: Script to scale CPU to powersave when on battery

Then I found script /etc/laptop-mode/conf.d/cpufreq.conf which has:

BATT_CPU_MAXFREQ=fastest
BATT_CPU_MINIFREQ=slowest
BATT_CPU_GOVERNOR=ondemand
BATT_CPU_IGNORE_NICE_LOAD=1
LM_AC_CPU_MAX_FREQ=fastest
... same as BATT_*
NORM_AC_CPU_MAXFREQ=fastest
... same as BATT_*

This seems to be the right way of doing the job, I think BATT_* means on battery, but what are LM_AC and NORM_AC? NORM_AC looks like normal AC, what about LM_AC?

Thanks a lot!

Offline

#3 2009-01-18 17:50:10

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 677

Re: Script to scale CPU to powersave when on battery

On the wiki you can find useful info about CPU frequency scaling:

http://wiki.archlinux.org/index.php/CPU … cy_Scaling

Offline

#4 2009-01-18 18:34:13

stonecrest
Member
From: Boulder
Registered: 2005-01-22
Posts: 1,190

Re: Script to scale CPU to powersave when on battery

Unless you are unable to get ondemand working for your processor, don't use performance/powersave - they are inferior choices.

For example, imagine a process requires 1 minute of active processing at full speed. If you use powersave, yes, the computer will use less energy. But that 1 minute of processing will now take more time to run. How is that a good thing? You are only saving power because you are waiting longer for everything to run. And the savings aren't linear to cpu speed because of ondemand's ability to be in deeper sleep cycles more often.

On the performance side, ondemand is just as fast as performance (when processes need cpu power, both run at maximum speed) but ondemand can use less energy when the cpu's not needed.


I am a gated community.

Offline

#5 2009-01-19 01:11:47

Olnex
Member
Registered: 2008-04-10
Posts: 89

Re: Script to scale CPU to powersave when on battery

Thanks a lot! Now I understand what I should use.

Offline

#6 2009-01-19 01:16:31

Olnex
Member
Registered: 2008-04-10
Posts: 89

Re: Script to scale CPU to powersave when on battery

Now I have a new problem, I use laptop-mode to control scaling, now I always use ondemand, so does it mean I do not need laptop-mode anymore(ie get rid of it from daemon in rc.conf)? What else does it do?
Thanks a lot!

Offline

#7 2009-01-19 01:19:35

Olnex
Member
Registered: 2008-04-10
Posts: 89

Re: Script to scale CPU to powersave when on battery

The reason I use laptop-mode and all sorts of scalings is to save power, my laptop can last 3 hours of normal use(wifi, web) on XP but only below 2 hours on Linux.
I also tried powertop, there are several things it asks me to do, but there are something that I  have to do every time, for example, it asks me to issue a command to disable something called cdrom polling, but when I reboot, I need to do it again in powertop.

Last edited by Olnex (2009-01-19 01:22:04)

Offline

#8 2009-01-20 21:01:33

miksirikki
Member
Registered: 2008-12-02
Posts: 9

Re: Script to scale CPU to powersave when on battery

have you checked out http://lesswatts.org/ ?

Offline

#9 2009-01-21 02:21:49

stonecrest
Member
From: Boulder
Registered: 2005-01-22
Posts: 1,190

Re: Script to scale CPU to powersave when on battery

laptop-mode is certainly not needed just to set the frequency. I'd suggest cpufrequtils, it's very lightweight and simple.


I am a gated community.

Offline

#10 2009-01-21 02:43:49

Svenstaro
Developer
From: Germany
Registered: 2008-11-19
Posts: 366

Re: Script to scale CPU to powersave when on battery

I wrote you a puny, tiny and inherently small section on the wiki concerning your issue: http://wiki.archlinux.org/index.php/Cpu … CPI_Events

Offline

Board footer

Powered by FluxBB