Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Discussion & Documentation Documentation, Tips & Tricks
  • Search

CPUFreq Guide

Unofficial documentation for various parts of Gentoo Linux. Note: This is not a support forum.
Post Reply
Advanced search
15 posts • Page 1 of 1
Author
Message
darkfolk
n00b
n00b
Posts: 32
Joined: Sun Jan 30, 2005 3:09 pm

CPUFreq Guide

  • Quote

Post by darkfolk » Mon Jan 31, 2005 4:22 am

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: Select all

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: Select all

# 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.
Top
darkfolk
n00b
n00b
Posts: 32
Joined: Sun Jan 30, 2005 3:09 pm

  • Quote

Post by darkfolk » Tue Feb 01, 2005 12:29 pm

Code: Select all

${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.
Top
brodo
Guru
Guru
Posts: 319
Joined: Tue Apr 15, 2003 10:52 pm

  • Quote

Post by brodo » Tue Feb 01, 2005 12:49 pm

Also of use is the (new) cpufrequtils package and its two tools cpufreq-info and cpufreq-set. E.g.

Code: Select all

cpufreq-info -c 1 -f
returns the current CPU frequency on CPU 1. cpufreqd will depend on cpufrequtils soon.
Top
darkfolk
n00b
n00b
Posts: 32
Joined: Sun Jan 30, 2005 3:09 pm

  • Quote

Post by darkfolk » Tue Feb 01, 2005 10:17 pm

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 :(
Top
brodo
Guru
Guru
Posts: 319
Joined: Tue Apr 15, 2003 10:52 pm

  • Quote

Post by brodo » Tue Feb 01, 2005 10:30 pm

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 :wink:
Top
Pleun
n00b
n00b
Posts: 38
Joined: Sat Feb 05, 2005 3:55 pm

  • Quote

Post by Pleun » Wed Feb 16, 2005 1:41 pm

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?
Top
brodo
Guru
Guru
Posts: 319
Joined: Tue Apr 15, 2003 10:52 pm

  • Quote

Post by brodo » Wed Feb 16, 2005 2:01 pm

/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
Top
Pleun
n00b
n00b
Posts: 38
Joined: Sat Feb 05, 2005 3:55 pm

  • Quote

Post by Pleun » Wed Feb 16, 2005 2:15 pm

So cpufreqd is running then. Weird, I don't really see a "batterylife-boost", while it should use way less power at 400 mhz.
Top
Vishruth
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 138
Joined: Fri Oct 25, 2002 9:35 am
Location: India
Contact:
Contact Vishruth
Website

  • Quote

Post by Vishruth » Wed Feb 23, 2005 3:32 am

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: Select all

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.
Top
camillo
n00b
n00b
Posts: 45
Joined: Tue Sep 30, 2003 10:51 am
Location: Torino, Italy

  • Quote

Post by camillo » Thu Mar 03, 2005 4:05 pm

I have a laptop with a Pentium 3 NON mobile.
Is possible to use frequency scaling or I need a Pentium M?

Thanks
Top
brettlpb
Apprentice
Apprentice
User avatar
Posts: 197
Joined: Tue May 27, 2003 9:43 pm

  • Quote

Post by brettlpb » Fri Mar 04, 2005 4:30 am

Sorry pentium-3's don't support freq scaling afaik.
Top
sidkdbl07
Apprentice
Apprentice
User avatar
Posts: 184
Joined: Sun May 25, 2003 5:37 pm

  • Quote

Post by sidkdbl07 » Mon Mar 14, 2005 11:46 pm

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?
Top
jballou
Tux's lil' helper
Tux's lil' helper
Posts: 128
Joined: Thu Mar 10, 2005 2:18 am
Location: Baghdad, Iraq

  • Quote

Post by jballou » Thu Mar 24, 2005 10:55 pm

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.
Top
leks
n00b
n00b
User avatar
Posts: 40
Joined: Mon Oct 11, 2004 12:27 am

  • Quote

Post by leks » Fri Apr 01, 2005 10:38 pm

brettlpb wrote:Sorry pentium-3's don't support freq scaling afaik.
wrong
FreeBSD is neat
Top
The Funky Pkunk
n00b
n00b
Posts: 13
Joined: Mon Nov 01, 2004 11:42 pm
Location: Trondheim, Norway

  • Quote

Post by The Funky Pkunk » Tue Apr 05, 2005 1:33 pm

In the default config there are the following lines:

Code: Select all

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
Top
Post Reply

15 posts • Page 1 of 1

Return to “Documentation, Tips & Tricks”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic