[TriLUG] Setting My Processor's Frequency in Ubuntu

Josh Vickery vickeryj at gmail.com
Wed Jun 29 08:54:42 EDT 2005


I don't know about powernowd, but I run cpufreqd, which has the nice
cpufreq-set command.  I use this to set my processor to its lowest
frequency when my screensaver comes on using xscreensaver-command
-watch.

Here is the perl script I use to do this:

#!/usr/bin/perl -w

use strict;


open (IN, "xscreensaver-command -watch |");
while (<IN>) {
  if (m/^LOCK/ or m/^BLANK/) {
    system("/usr/bin/sudo /etc/init.d/cpufreqd stop");
    system("/usr/bin/sudo /usr/local/bin/cpufreq-set -u 600");
  }
  elsif (m/^UNBLANK/) {
    system("/usr/bin/sudo /etc/init.d/cpufreqd start");
  }
}

In short, when the screensaver blanks or locks, I kill cpufreqd, and
run cpufreq-set, then when it unblanks, I start cpufreqd again. 
Perhaps you could adapt this for use with powernowd.  Alternately you
could start running cpufreqd yourself, which allows you to specify
different power rules based on various properties such as AC adapter
presence and CPU usage.

I also use laptop mode to keep my disk spun down when on battery, this
seems to help my battery life as long as I am not doing disk intensive
things, at which point it becomes more of an annoyance than anything
else.

In order to eak out even more battery life while surfing the web, I
disabled the disk cache in firefox so that my drive could stay spun
down even longer while in laptop mode.


On 6/28/05, Randall Barlow <rpbarlow at ncsu.edu> wrote:
> Alan Porter wrote:
> 
> >It looks like Ubuntu is using powernowd to control the CPU speed.
> >The min and max speeds are specified in:
> >
> >/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
> >/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> >
> >You can echo your own (kHz) values here.
> >
> This does the trick!  Now just to automate it!
> 
> >  Is this a job for hotplug?
> >
> >
> I don't know, I'll let the list know when I find a solution
> 
> Thanks,
> Randy
> --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ  : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
> TriLUG PGP Keyring         : http://trilug.org/~chrish/trilug.asc
>



More information about the TriLUG mailing list