View previous topic :: View next topic |
Author |
Message |
darkfolk n00b
Joined: 30 Jan 2005 Posts: 32
|
Posted: Mon Jan 31, 2005 4:22 am Post subject: CPUFreq Guide |
|
|
CPUFreq Guide and Review
CPUFreq can be very useful on laptops, and even on desktops; to set it up on Gentoo to work perfectly how you want it takes time, but once tweaked, CPUFreq can run very smoothly.
First, you need a kernel with...
Power Management Options (ACPI,APM) -->
CPU Frequency Scaling -->
# we will use the cpufreqd daemon, so do not handle it automatically
Default CPUFreq Governor (userspace) -->
CPU Frequency Table Helpers (if your driver doesn't show up)
And a driver ( I chose Intel Pentium 4 Clock Modulation)
Code: |
emerge cpufreqd
# if you will use the "human-readable" frequency reading,
emerge cpufrequtils
# this if you don't have it. It looks nice ;)
emerge torsmo
# Torsmo tells me all the temps and frequencies in this setup.
|
after that is all set up, you will need a /etc/cpufreqd.conf. Example:
Code: |
# Remember to modify this with your own CPU frequencies (in Hz, check /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies for the HZ settings you
can use)
# Also, you need spaces between the sections like [Rule] [General] and [Profile] (they are already here in this example)
# This file was configured P4 2.80ghz (C version, Hyper-Threading, Northwood cor
e) on a desktop
[General]
pidfile=/var/run/cpufreqd.pid
poll_interval=1
pm_type=acpi #(acpi, apm or pmu)
# Uncomment the following line to enable ACPI workaround (see cpufreqd.conf(5))
# acpi_workaround=1
verbosity=3 #(if you want a minimal logging set to 5)
[Profile]
name=max_power
# These should be replaced with your own frequencies
minfreq=2100000
maxfreq=2800000
policy=userspace
[Profile]
name=medium_power
minfreq=1400000
maxfreq=1400000
policy=userspace
[Profile]
name=lo_power
minfreq=700000
maxfreq=1050000
policy=userspace
# for low power operations, use lo_power profile, since it will not need added pow
er. replace cpu_interval=0-40 with whatever CPU load you think should need only 700mhz-1000mhz (or whatever you chose) like cpu_interval=0-30.
[Rule]
name=lo_cpu_boost
ac=on
cpu_interval=0-40
profile=lo_power
# Something around the middle is happening, like the end of a portage sync or co
mpile; the CPU should be good in the 1.4ghz-1.75ghz range.
[Rule]
name=medium_cpu_boost
ac=on
cpu_interval=41-49
profile=medium_power
# Now the CPU needs some power, so give it full strength. This runs when you are doing something not listed in the last rule (which counts as more if the programs listed are running) is using a lot of cpu power
[Rule]
name=max_cpu_boost
ac=on
cpu_interval=50-100
profile=max_power
# various progs need full power, so give it to them, no matter what. These include movie players, and most things that run during a emerge. Modify this with programs that need power
[Rule]
name=power_needed
ac=on
# These programs, if running, will cause your CPU to go at 100% (in this case, 2.8ghz) remove any that you think should not cause this.
programs=xine,mplayer,gmplayer,avidemux,gcc,g++,emerge,cc,nbench,automake,config
ure,autoconfig,make
# CPU Interval = CPU Load
cpu_interval=0-100
profile=max_power
|
If you have a processor with HyperThreading or SMP, check /sys/devices/cpu/cpu0/cpufreq/affected_cpus . Of course, on HT, the same processor is being used, so it doesn't matter, but on other processors you should check it.
Now that that is done and over with, open three consoles. (or one, if you will run cpufreqd without a temperature reading or frequency reading (or do not need a script to do this)) One will run tailfreq, the other temps. The last one will run:
cpufreqd -D -f /etc/cpufreqd.conf -V 6
Now you will see tons of output. Keep an eye on whatever you use to see the frequencies, so you know what speed your CPU is running.
Congratulations, you are done!
Questions, Comments?
Of course, the tailfreq and temps script could be replaced with a torsmo or anything else you want to use ( I use torsmo)
Last edited by darkfolk on Tue Feb 01, 2005 10:18 pm; edited 3 times in total |
|
Back to top |
|
|
darkfolk n00b
Joined: 30 Jan 2005 Posts: 32
|
Posted: Tue Feb 01, 2005 12:29 pm Post subject: |
|
|
Code: |
${color red}Burning CPU Frequency:
${execi 1 cpufreq-info -c 0 -m -f}
|
Now you'll need to emerge CPUfrequtils, but this looks a lot nicer (thanks)
Last edited by darkfolk on Tue Feb 01, 2005 10:06 pm; edited 1 time in total |
|
Back to top |
|
|
brodo Guru
Joined: 15 Apr 2003 Posts: 319
|
Posted: Tue Feb 01, 2005 12:49 pm Post subject: |
|
|
Also of use is the (new) cpufrequtils package and its two tools cpufreq-info and cpufreq-set. E.g. Code: | cpufreq-info -c 1 -f | returns the current CPU frequency on CPU 1. cpufreqd will depend on cpufrequtils soon. |
|
Back to top |
|
|
darkfolk n00b
Joined: 30 Jan 2005 Posts: 32
|
Posted: Tue Feb 01, 2005 10:17 pm Post subject: |
|
|
cpufreq-info -c 0 -m -f works better (comes in Mhz/Ghz form instead of Hz)
I'd show you some screenshots, but I forgot how to take them without using something like ksnapshot so no screenies |
|
Back to top |
|
|
brodo Guru
Joined: 15 Apr 2003 Posts: 319
|
Posted: Tue Feb 01, 2005 10:30 pm Post subject: |
|
|
darkfolk wrote: | cpufreq-info -c 0 -m -f works better (comes in Mhz/Ghz form instead of Hz) |
I'm glad you like this feature |
|
Back to top |
|
|
Pleun n00b
Joined: 05 Feb 2005 Posts: 38
|
Posted: Wed Feb 16, 2005 1:41 pm Post subject: |
|
|
small question: does /proc/cpuinfo list the real-time cpuspeed, or only the 'normal' cpuspeed?
Seems like my cpufreqd is running, and cpufreq-info tells me it's running on 383,xxx mhz, but my /proc/cpuinfo still shows 3.064 ghz, and i don't see a big change on my battery-usage too. I'm using HT btw, maybe that has something to do with it? |
|
Back to top |
|
|
brodo Guru
Joined: 15 Apr 2003 Posts: 319
|
Posted: Wed Feb 16, 2005 2:01 pm Post subject: |
|
|
/proc/cpuinfo does not report "true" CPU frequency if the kernel is built with SMP support, and as HT requires SMP support, you better use cpufreq-info from cpufrequtils |
|
Back to top |
|
|
Pleun n00b
Joined: 05 Feb 2005 Posts: 38
|
Posted: Wed Feb 16, 2005 2:15 pm Post subject: |
|
|
So cpufreqd is running then. Weird, I don't really see a "batterylife-boost", while it should use way less power at 400 mhz. |
|
Back to top |
|
|
Vishruth Tux's lil' helper
Joined: 25 Oct 2002 Posts: 138 Location: India
|
Posted: Wed Feb 23, 2005 3:32 am Post subject: |
|
|
I wrote this little python script that works with the userspace governor. I wrote it for my own use, but others may also find it useful... Great thread, btw.
Oh, and also, this script automatically checks what the scaling governor is when you try to change the frequency. If scaling_governor is not set to 'userspace', it will try to automatically do it for you and then it will attempt to change the frequency. You can check for the current frequency and governor as a normal user, but you'll need to be root to change the CPU frequency and the scaling governor.
http://www.thepyromania.com/python/pycf.py
Code: | pycf (Python Cpufreq) ver. 01 for supported processors.
(single processors only!)
pycf v. 01 only supports the 'userspace' governor.
Usage:
pycf.py <option> <arg>
-a >> Show all available frequencies for the current CPU.
-c >> Show current CPU frequency and current scaling governor.
-f >> pycf.py -f <freq.>
Changes CPU frequency to the number given.
-g >> Sets governor to 'userspace'.
-h >> Show this help message.
-m >> pycf.py -m <other options> <args>
Use MHz instead of the default KHz. |
|
|
Back to top |
|
|
camillo n00b
Joined: 30 Sep 2003 Posts: 45 Location: Torino, Italy
|
Posted: Thu Mar 03, 2005 4:05 pm Post subject: |
|
|
I have a laptop with a Pentium 3 NON mobile.
Is possible to use frequency scaling or I need a Pentium M?
Thanks |
|
Back to top |
|
|
brettlpb Apprentice
Joined: 27 May 2003 Posts: 197
|
Posted: Fri Mar 04, 2005 4:30 am Post subject: |
|
|
Sorry pentium-3's don't support freq scaling afaik. |
|
Back to top |
|
|
sidkdbl07 Apprentice
Joined: 25 May 2003 Posts: 184
|
Posted: Mon Mar 14, 2005 11:46 pm Post subject: |
|
|
I'm a real noob at this....
I have cpufreqd running like you said....
Do I have to do "rc-update add..." or anything to get this to run automatically?
What do I do with torsmo? |
|
Back to top |
|
|
jballou Tux's lil' helper
Joined: 10 Mar 2005 Posts: 128 Location: Baghdad, Iraq
|
Posted: Thu Mar 24, 2005 10:55 pm Post subject: |
|
|
sid: Yes, 'rc-update add cpufreqd default' works. _________________ -Shuttle SN25P, Opteron 185, 74Gb WD Raptor, 2x 300Gb Barracuda 7200.9, 2x 1Gb Corsair dual channel, BFG GeForce 7800GT
-Asus Z7100 laptop, P-M 2.13, 2Gb DDR, 100Gb 7200RPM HDD, 128Mb GeForce 6600 Go. |
|
Back to top |
|
|
leks n00b
Joined: 11 Oct 2004 Posts: 40
|
Posted: Fri Apr 01, 2005 10:38 pm Post subject: |
|
|
brettlpb wrote: | Sorry pentium-3's don't support freq scaling afaik. |
wrong _________________ FreeBSD is neat |
|
Back to top |
|
|
The Funky Pkunk n00b
Joined: 01 Nov 2004 Posts: 13 Location: Trondheim, Norway
|
Posted: Tue Apr 05, 2005 1:33 pm Post subject: |
|
|
In the default config there are the following lines:
Code: | cpu_nice_scale=1.5
delay_cycles=3 |
However, I can't seem to find anything in the manpage or from googling as to what these lines actually do. Anyone got an idea? _________________ Cheers,
The Funky Pkunk |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|