Fedora Linux Support Community & Resources Center
  #1  
Old 31st December 2009, 10:02 PM
dd_wizard's Avatar
dd_wizard Offline
Registered User
 
Join Date: Sep 2009
Posts: 1,409
linuxfirefox
Using acpi: thermal/sysfs-api To Extend Battery Life

This link, acpi: thermal/sysfs-api, explains how the new thermal management sysfs class is built, but doesn't give much information about using it. Using watch, I can see that the cur_state of cooling_device2 changes from 0 to 5 when I check "Dim display when idle" in Power Management Preferences. But I haven't found an applet that changes cooling_device0 or cooling_device1.

Echoing different integers to the cur_state files limits the maximum cpu frequency for cpu0 and cpu1, respectively. This behaviour is expected from what I've read, and mimics the options in Windows power manager for extending battery life by throttling the CPUs. I've had no luck with google and local man pages, so has anybody has seen an applet for controlling /sys/class/thermal/cooling_device[0|1]/cur_state?

On a side note, a value of 1 does slow the CPU down, but it will still hit 100C (normal for an Intel mobile duo core). However, values of 2 and larger throttle enough to lower the maximum CPU temp. Since the CPU temp is a good indicator of power consumption, it's pretty obvious that these two cur_state files are intended to extend battery life.

dd_wizard

---------- Post added at 02:02 PM CST ---------- Previous post was at 01:59 PM CST ----------

Bah! Can someone change the thead title to his one for me, please?? TITLE: Using acpi: thermal/sysfs-api To Extend Battery Life

Last edited by dd_wizard; 4th February 2010 at 11:40 PM.
Reply With Quote
  #2  
Old 31st December 2009, 10:12 PM
GallComp's Avatar
GallComp Online
Nuke 'em Alfred! Administrator - Starring in Bill & Steve's Bogus Journey
 
Join Date: Mar 2004
Location: Fontana, CA
Age: 37
Posts: 2,333
windows_7ie
Quote:
Originally Posted by dd_wizard View Post
Bah! Can someone change the thead title to his one for me, please?? TITLE: Using acpi: thermal/sysfs-api To Extend Battery Life
Done...
__________________

"Since when has the world of computer software design been about what people want? This is a simple question of evolution. The day is quickly coming when every knee will bow down to a silicon fist, and you will all beg your binary gods for mercy. "


BILL GATES...
Reply With Quote
  #3  
Old 4th February 2010, 11:56 PM
dd_wizard's Avatar
dd_wizard Offline
Registered User
 
Join Date: Sep 2009
Posts: 1,409
linuxfirefox
Since nobody replied, I decided to figure out how things work. The following bash script has been tested in Fedora 12, and most likely won't work in other versions. First, the script:
Code:
#!/bin/sh
# Script to throttle cpu speed.
# Works for any number of cpus, but only tested on Fedora 12.
# I have no idea how long this will be around,
# see http://patchwork.kernel.org/patch/43071 for more info.

if [ -n "$1" ]
then
  let "state = $1 + 0"
  if [ "$state" -ne "$1" ] || [ "$state" -lt "0" ]
  then
    echo "Usage: `basename $0` [ non-negative integer ]"
    exit 1
  fi
  for device in `ls -d /sys/devices/virtual/thermal/cooling_device*`
  do
    if [ "`cat $device/type`" = "Processor" ]
    then
      let "max_state = `cat $device/max_state`"
      if [ "$state" -gt "$max_state" ]
      then
        echo $max_state  > "$device/cur_state"
      else
        echo $state  > "$device/cur_state"
      fi
    fi
  done
fi
echo "Current CPU thermal cooling states:"
for device in `ls -d /sys/devices/virtual/thermal/cooling_device*`
do
  if [ "`cat $device/type`" = "Processor" ]
  then
    echo "$device = `cat $device/cur_state` "
  fi
done
exit 0
For testing, I ran two threads of Prime95 to push both CPUs to 100%. Setting cur_state to 1 capped the CPU frequency at roughly 75%, 1.33GHz on a 1.73GHz duo core processor. It's a laptop, so both CPUs bumped against 99C even at 1.33GHz. Setting cur_state to 2 dropped the frequency to 800MHz, and dropped the temperatures to 86C. With just one thread running, which simulates one runaway process, the maximum temperature was 94C for a cur_state of 1. I'm not sure if it's my BIOS, or Fedora, but the thread switches between CPUs to balance the temperatures. See the attached screenshot.

This mimics the behaviour of the Windows power manager. The default maximum battery life scheme for Toshiba laptops limits the CPU frequency to 50%.

dd_wizard

P.S. You can run the script as an unprivileged user to display the current states, but you need to run it with su -c "cputhrottle 2" to write to the files.
Attached Thumbnails
Click image for larger version

Name:	Screenshot-System Monitor.png
Views:	66
Size:	66.3 KB
ID:	19005  

Last edited by dd_wizard; 5th February 2010 at 12:21 AM.
Reply With Quote
Reply

Tags
acpi, battery, extend, life, thermal or sysfsapi

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tips on how to extend battery life infernosoft Hardware & Laptops 17 11th September 2009 08:16 AM
Battery life mitchell2345 Hardware & Laptops 23 27th January 2007 06:48 PM
acpi thermal module is missing feta Using Fedora 5 23rd October 2005 04:23 AM
Battery Life Cruzader Hardware & Laptops 14 7th July 2005 05:28 PM
Where does the kernel get the default values in /proc/acpi/thermal/THRM/trip_points? Kane Hardware & Laptops 0 11th June 2005 01:18 PM


Current GMT-time: 12:31 (Monday, 20-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat