From owner-freebsd-questions@freebsd.org Thu Aug 11 12:02:04 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55771BB6BCE for ; Thu, 11 Aug 2016 12:02:04 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from sola.nimnet.asn.au (paqi.nimnet.asn.au [115.70.110.159]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BD59B1FD1 for ; Thu, 11 Aug 2016 12:02:02 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from localhost (localhost [127.0.0.1]) by sola.nimnet.asn.au (8.14.2/8.14.2) with ESMTP id u7BC1iKx047024; Thu, 11 Aug 2016 22:01:45 +1000 (EST) (envelope-from smithi@nimnet.asn.au) Date: Thu, 11 Aug 2016 22:01:44 +1000 (EST) From: Ian Smith To: Aleksander Alekseev cc: freebsd-questions@freebsd.org Subject: Re: Power consumption tuning In-Reply-To: <20160810214218.6788f2c1@e733> Message-ID: <20160811212417.V79687@sola.nimnet.asn.au> References: <20160811015734.D79687@sola.nimnet.asn.au> <20160810214218.6788f2c1@e733> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Aug 2016 12:02:04 -0000 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@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