Power consumption tuning
Ian Smith
smithi at nimnet.asn.au
Thu Aug 11 12:02:04 UTC 2016
On Wed, 10 Aug 2016 21:42:18 +0300, Aleksander Alekseev wrote:
> Thanks for a detailed reply!
Thanks for not quoting it all :)
> > Well [1] stresses the importance of using maximum available C-states
> > on your hardware. But except for powerd and C-states where possible,
> > I wouldn't bother with all that to save an extra few watts on a
> > desktop.
> >
> > > [1] https://wiki.freebsd.org/TuningPowerConsumption
>
> Well, I took a look on /etc/defaults/rc.conf and discovered that
> default values are:
>
> ```
> performance_cx_lowest="C2"
> economy_cx_lowest="Cmax"
> ```
>
> Since article describes C3 as a pretty dangerous thing I doubt that
> these parameters are worth tuning in my case.
Perhaps not, but these are 'conservative' defaults as _some_ systems
don't like Cmax (usually C3) on AC power, but I'd encourage you to try
Cmax on AC as well .. the worst likely to happen is that it won't work.
Not sure about 10.x but on 9.3 and earlier, defaults were both "HIGH" ie
C1 and you always had to update these in rc.conf for laptops.
C3 works just fine on my X200, and even on my ancient IBM ThinkPad T23:
smithi on t23% t23stat
Thu Aug 11 21:40:00 EST 2016 dev.cpu.0.freq: 733
0.03% 24.97% 74.99% last 590us { 0.55 0.70 0.65 }
[ C1 C2 C3 : percentage of idle (halt) cycles spent in each]
> > What hardware? What OS version?
>
> 11.0-beta4 on Fujitsu Lifebook E733 laptop. BTW it's a great laptop for
> FreeBSD. Works everything including Wi-Fi adapter and hibernation.
> I didn't check bluetooth, webcam and fingerprint scanner though. I
> disabled this stuff in BIOS a long time ago since I don't use it anyway.
Fair enough; I like most Fujitsus I've seen, never owned one though.
I include below the script I use on my Lenovo X200 to see how things are
going; perhaps you'll find some of it useful, especially seeing what Cx
state usage is with different loads and such, and for reporting power
consumption while running on battery.
cheers, Ian
=======
root at x200:/usr/head/src # x200stat
Thu Aug 11 21:31:50 AEST 2016 dev.cpu.0.freq: 800
0.00% 1.77% 98.22% last 312us { 0.06 0.02 0.00 }
0.00% 1.29% 98.69% last 197us { HPET one-shot }
dev.acpi_ibm.0.thermal: 45 44 -1 44 35 -1 33 -1
hw.acpi.thermal.tz0.temperature: 45.0C tz1: 44.0C
dev.acpi_ibm.0.fan_level: 0 _speed: 3778
high capacity: 96% time: unknown
rate: 0 mW voltage: 12418 mV
=======
#!/bin/sh
# x200stat smithi freebsd 9+ 2 CPUs # polished 16-18/11/15 & 7/12/15
SN="sysctl -n"; t=' ' # tab # backtick haters need not apply
[ `$SN kern.eventtimer.periodic` -eq 1 ] && p=periodic || p=one-shot
echo -n "`date` "; sysctl dev.cpu.0.freq
echo "`$SN dev.cpu.0.cx_usage`${t}`$SN vm.loadavg`"
echo "`$SN dev.cpu.1.cx_usage`${t}{ `$SN kern.eventtimer.timer` $p }"
sysctl dev.acpi_ibm.0.thermal
echo -n "`sysctl hw.acpi.thermal.tz0.temperature`"
echo "${t}tz1: `$SN hw.acpi.thermal.tz1.temperature`"
echo -n "`sysctl dev.acpi_ibm.0.fan_level`"
echo "${t}_speed: `$SN dev.acpi_ibm.0.fan_speed`"
acpiconf -i0 | egrep 'State|Remain|Present' | xargs echo | \
(
next=0; rem=0; pre=0
for i in `cat -`; do # working if kinda ugly parsing ..
if [ $next -gt 0 ]; then
[ "$i" = "high" ] && i="high$t" # else {,dis}charging
[ "$i" = "voltage:" ] && echo -n "$t"
[ $next -eq 2 ] && [ $pre -eq 0 ] && echo -n "$t"
echo -n "$i "
[ "$i" = "critical" ] || next=$((next-1))
continue
fi
case $i in
State:)
next=1 ;;
Remaining)
[ $rem -eq 0 ] && rem=1 && echo -n " "
next=2 ;; # capacity: nn% then time: hh:mm
Present)
[ $pre -eq 0 ] && pre=1 && echo
next=3 ;; # rate: nnnnn mW then voltage: nn mV
*)
echo -n " unexpected!: $i " ;;
esac
done
)
echo
exit 0
More information about the freebsd-questions
mailing list