For those who do not know FreeBSD is able to scale CPU speed (both desktop and mobile onesm thy just nned to support it and have enabled it in BIOS).

To enable that feature you need to add this line to /etc/rc.conf:

Code:

powerd_enable="YES"

You can also tweak how much you CPU will scale depends on the load, for example:

Code:

powerd_flags="-i 85 -r 60 -p 100"

powerd by default use adaptive mode (thanks to BSDKaffee)

You can also tweak lowest CPU frequency used by CPU by setting this in /etc/sysctl.conf or /boot/loader.conf:

Code:

debug.cpufreq.lowest=600

You can also set it by hand in terminal using sysctl:

Code:

sysctl debug.cpufreq.lowest=600

Up to yesterday there was no option to set highest value to limit max CPU speed to save power or limit overheat, but Boris Kochergin wrote a patch to support also the highest limit with debug.cpufreq.highest oid:

Code:

sysctl debug.cpufreq.highest=1200

These patches are for 7.0-RELEASE and 7-STABLE (I did not checked 8-CURRENT but propably also works):

--- cpufreq.4.orig 2008-11-08 13:08:19.000000000 -0500
+++ cpufreq.4 2008-11-08 13:08:51.000000000 -0500
@@ -98,6 +98,11 @@
This setting is also accessible via a tunable with the same name.
This can be used to disable very low levels that may be unusable on
some systems.
+.It Va debug.cpufreq.highest
+Highest CPU frequency in MHz to offer to users.
+This setting is also accessible via a tunable with the same name.
+This can be used to disable very high levels that may be unusable on
+some systems.
.It Va debug.cpufreq.verbose
Print verbose messages.
This setting is also accessible via a tunable with the same name.

You can also set Cx sleep state for your CPUs with dev.cpu.1.cx_lowest and dev.cpu.0.cx_lowest and so per CPU.

You can change them that:

Code:

# sysctl dev.cpu.0.cx_lowest=C3
dev.cpu.1.cx_lowest: C1 -> C3

WARN: Dunno for other laptops but when I use lowest C3 step for all cores, then I have little lag when I use my touchpad, this can be easily eliminated when you set one of the CPUs to C2 and all other to C3 to save power, no lag with that settings.

... and by the way, setting kern.hz=100 in /boot/loader.conf will also make your battery life little longer.

WARN: If these options differ for AMD CPUs, then let me know, or just pot them in this thread.

If you have any questions or I forgot about something then let me know

__________________religions, worst damnation of mankind"If 386BSD had been available when I started on Linux, Linux would probably never had happened." Linus TorvaldsLinux is not UNIX! Face it! It is not an insult. It is fact: GNU is a recursive acronym for “GNU's Not UNIX”.vermaden's:linksresourcesdeviantartspreadbsd

__________________religions, worst damnation of mankind"If 386BSD had been available when I started on Linux, Linux would probably never had happened." Linus TorvaldsLinux is not UNIX! Face it! It is not an insult. It is fact: GNU is a recursive acronym for “GNU's Not UNIX”.vermaden's:linksresourcesdeviantartspreadbsd

I don't mean to sound too critical, but I think the multiple spelling errors detract from this otherwise interesting guide. I know other guides have the same problem, so I'm not just picking on vermaden here. In my opinion guides should be given special care from ordinary posts and be written with a minimally educated user in mind as they may take an error at face value.

A few things besides spelling (that are somewhat important):

Quote:

Originally Posted by vermaden

Code:

power_enable="YES"

Should be:

Code:

powerd_enable="YES"

Quote:

Originally Posted by vermaden

Code:

powerd_flags="-a adaptive -b adaptive -n adaptive -i 85 -r 60 -p 100"

powerd defaults to use adaptive mode, so the following line would be sufficient:

Code:

powerd_flags="-i 85 -r 60 -p 100"

Just out of curiosity, could you also explain why you think these are better values than the defaults? Especially the polling interval.

Quote:

Originally Posted by vermaden

Code:

# sudo sysctl dev.cpu.0.cx_lowest=C3
dev.cpu.1.cx_lowest: C1 -> C3

Not everyone uses sudo, and since the prompt is already '#', I think that would be sufficient enough to explain that the command needs to be run as root.

I don't mean to sound too critical, but I think the multiple spelling errors detract from this otherwise interesting guide.

Thanks mate, I think I corrected them.

Quote:

Originally Posted by BSDKaffee

Just out of curiosity, could you also explain why you think these are better values than the defaults? Especially the polling interval.

Uses lower frequencies, these values (as from manual) specifya at what load level to change current speed to lower or higher value, default values higher the clock at lower load and the same for lower clock. The interval specifies how often the clock speed will change, many processes lower down their CPU usage for short period of time, with 500ms (0.5 second) you will not be able to "catch" these chances to save power, with 100 (or even 50 but you use more CPU power for polling) you are able to higher frequency much faster, in both sides.

Quote:

Originally Posted by BSDKaffee

Not everyone uses sudo, and since the prompt is already '#', I think that would be sufficient enough to explain that the command needs to be run as root.

And that was the purpose of #, I just forgot to remove sudo.

Quote:

Originally Posted by BSDKaffee

Thanks...just trying to be constructive.

Thanks for corrections mate

I added power consumption of my CPU depends on MHz used.

__________________religions, worst damnation of mankind"If 386BSD had been available when I started on Linux, Linux would probably never had happened." Linus TorvaldsLinux is not UNIX! Face it! It is not an insult. It is fact: GNU is a recursive acronym for “GNU's Not UNIX”.vermaden's:linksresourcesdeviantartspreadbsd

__________________religions, worst damnation of mankind"If 386BSD had been available when I started on Linux, Linux would probably never had happened." Linus TorvaldsLinux is not UNIX! Face it! It is not an insult. It is fact: GNU is a recursive acronym for “GNU's Not UNIX”.vermaden's:linksresourcesdeviantartspreadbsd

Up to yesterday there was no option to set highest value to limit max CPU speed to save power or limit overheat, but Boris Kochergin wrote a patch to support also the highest limit with debug.cpufreq.highest oid:
Code:
sysctl debug.cpufreq.highest=1200

I've been thinking, and I wonder just how useful this is.

A 2GHz CPU running at 1GHz will not consume anywhere near half the power, while a CPU running at 2GHz will complete a task close to twice as fast.
The result is that the CPU will take more time to complete a task, and it will require more power in the end.

I haven't done any test, but I suspect that setting this value lower than the maximum will actually cause the battery to last shorter.

__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.

While Boris' original patch to add debug.cpufreq.highest sysctl support to kern_cpu.c was gently rejected (PR 144232, I'm too new to port URLs yet), he then filed a patch to add -M and -m to powerd(8) (PR 145063), which allows the user to set minimum and maximum clock speeds.

The patch was committed to 7-STABLE and 8-STABLE in September 2010, and should be part of 7.4 and 8.2.

Currently I always add these patches into GENERIC config and rebuild kernel with:

Code:

# make NO_MODULES=1 buildkernel

__________________religions, worst damnation of mankind"If 386BSD had been available when I started on Linux, Linux would probably never had happened." Linus TorvaldsLinux is not UNIX! Face it! It is not an insult. It is fact: GNU is a recursive acronym for “GNU's Not UNIX”.vermaden's:linksresourcesdeviantartspreadbsd