![]() |
2011-08-15
, 23:00
|
Banned |
Posts: 695 |
Thanked: 308 times |
Joined on Apr 2011
@ originally pakistan ,now in china
|
#2
|
![]() |
2011-08-27
, 17:26
|
Posts: 118 |
Thanked: 59 times |
Joined on May 2007
|
#3
|
battery drainage is more concerned with Xorg though if some one could work on that as well.nice work though and to prove that need testers .
#!/bin/sh #Kill runaway hildon-home processes. #Checks processor load of hildon-home every 60 seconds, except when screen is unlocked. #Kills hildon-home if two of three successive checks show load over threshhold #Contains some leftover code from earlier versions if [ -e /home/user/hhkills-prev ] #delete backup log, if it exists then rm /home/user/hhkills-prev fi if [ -e /home/user/hhkills ] #rename most recent log to backup, if it exists then mv /home/user/hhkills /home/user/hhkills-prev fi echo "Start: " `date` > /home/user/hhkills #start new log #initialize values HH1=0 HH2=0 HHTHRESH=50 #Threshhold: hildon-home processor loads above this value will be considered excessive HHPAUSE=60 #Pause between cycles: the script waits this many seconds between checks #start loop while 'true' do #shift previous values down HH3=$HH2 HH2=$HH1 #get screen lock status SCRSTAT=`dbus-send --system --type=method_call --dest="com.nokia.mce" --print-reply "/com/nokia/mce/request" com.nokia.mce.request.get_tklock_mode|awk -F "\"" '/g/ {print $2}'` if [ "$SCRSTAT" = "unlocked" ] then HH1=0 #if the screen is unlocked, clear HH1 and HH2; do nothing else this cycle HH2=0 else #get processor load of hildon-home HHSTAT=`top -n1 | grep hildon-home | awk '{print $7}'` # | awk -F "." '{print $1}'` #final part truncates value to integer; moved below #echo $HHSTAT #used while debugging: sends HHSTAT as float to stdout #truncate HHSTAT to integer HHSTAT=`echo $HHSTAT | awk -F "." '{print $1}'` #compare HHSTAT to threshhold, set HH1 if above, clear it otherwise if [ "$HHSTAT" -gt "$HHTHRESH" ] then HH1=1 echo "hh $HHSTAT " `date` >> /home/user/hhkills #writes all above-threshhold values to log. Useful when debugging, but makes for very large log. else HH1=0 fi HHSUM=`expr $HH1 + $HH2 + $HH3` #echo $HHSUM #sometimes useful when debugging: sends sum to stdout #check if HH1, HH2 and HH3 have all been set. If so, kill hildon-home and log the kill if [ "$HHSUM" -ge "2" ] then #kill hildon-home and log the kill killall hildon-home echo "Kill: " `date` >> /home/user/hhkills HH1=0 #clear these values and give hildon-home a minute to restart and stabilize HH2=0 sleep 60 fi fi #pause before next cycle sleep "$HHPAUSE" done
However, it does appear to do the job for which it's intended: catching and killing runaway hildon-home processes before they drain the N900 battery. I start it with this command:
nohup hhkill &