Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
cpu speed governor based on temp [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on AMD64
View previous topic :: View next topic  
Author Message
pagaman
n00b
n00b


Joined: 23 Jan 2004
Posts: 25
Location: London

PostPosted: Tue Aug 02, 2005 6:07 am    Post subject: cpu speed governor based on temp [solved] Reply with quote

'lo peeps.

I've an acer aspire 1522.
Nice little laptop with one problem.
Whilst I've got a cpu governor going (powernowd)

It doesn't slow the cpu down when it gets too hot.

The upper thermal limit is 90C,
The fan is controlled by the bios, and speeds up nicely,
however if I'm doing anything cpu intensive, then powernowd puts the cpu on 100%
and the machine overheats.

Presumambly other people have got around this, so my question is how?
is there a way to get powernowd to respond to temperature, and slow the cpu down if it
get too hot?

Thanks in advance
_________________
History only remembers great people by forgetting their mistakes.


Last edited by pagaman on Tue Aug 02, 2005 12:28 pm; edited 1 time in total
Back to top
View user's profile Send private message
crazycat
l33t
l33t


Joined: 26 Aug 2003
Posts: 838
Location: Hamburg, Germany

PostPosted: Tue Aug 02, 2005 9:17 am    Post subject: Reply with quote

You can certainly write a script which reads temerature each 5 seconds somewhere from /sys/devices/platform/i2c-1/1-0290/bus/devices/ and modifiers userspace daemon accordinly through /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
Back to top
View user's profile Send private message
pagaman
n00b
n00b


Joined: 23 Jan 2004
Posts: 25
Location: London

PostPosted: Tue Aug 02, 2005 12:27 pm    Post subject: Reply with quote

Yeah, I've banged off a quick, little script, thats a bit crappy, but works...
Script is below in case someone comes across this searching for someting similar.

I'll probably end up changing it so that it stops / starts the powernowd daemon,
and make it a service...


#!/usr/bin/python

import os,re,time,string

hi=1800000
med=1600000
low=800000

critical_temp=85
hi_temp=80

def set_speed (speed):
speed_line = "Setting speed to %i" % speed
print speed_line
#os.system("echo %s > /dev/speech" % speed_line)
os.system("echo -n %i > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed" % speed)

def cpu_gov (command):
if (command == "start") :
#os.system("/etc/init.d/powernowd start > /dev/null")
print "Starting powernowd"

elif (command == "stop") :
#os.system("/etc/init.d/powernowd stop > /dev/null ")
print "stopping powernowd"


def get_temp():
CPU_temp_file = "/proc/acpi/thermal_zone/THRC/temperature"
fd = open(CPU_temp_file,"r")
line = fd.readline()
fd.close()
temp = re.search("\d\d",line)
return temp.group()


while 1:
temp = string.atoi(get_temp())
print "Temp is %i" % temp

if temp >= critical_temp:
cpu_gov("stop")
set_speed(low)
time.sleep(180)
elif temp >= hi_temp:
cpu_gov("stop")
set_speed(med)
else:
set_speed(hi)
cpu_gov("start")
time.sleep(5)
_________________
History only remembers great people by forgetting their mistakes.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on AMD64 All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum