Apr 22 2010, 08:28 AM
Scripts triggered by power/suspend changes are located in /etc/pm
They are triggered twice per change first time with "true" or "false" argument when power change is triggered and second time with "suspend suspend" or "suspend resume" when that change is finishing. That means when you do a full cycle suspend-resume they got triggered four times.
Simply put your script in /etc/pm and link in apropriate directory there and note what is happening.
Its useful to pause and resume mpd or when you dont want to use thick power agent (ie in text mode) to make suspend/resume or backlight change when button is pressed or lid closed/open.
Apr 22 2010, 02:03 PM
Another small utility I made:
fmp=`cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state|grep 800000|cut -d " " -f 2`
smp=`cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state|grep 160000|cut -d " " -f 2`
# echo "---$smp-"
((tmp3= $tmp - $tmp2))
((fmp3= $fmp - $fmp2))
((smp3= $smp - $smp2))
echo "$tmp3 $fmp3 $smp3"
this script prints how many times cpu was switched between low (160 MHz) to high (800MHz) clock and how long int was working in both modes.
Output looks like this:
34 162 353
26 74 438
20 61 452
0 512 0
10 387 133
9 61 452
First column is number of switches next is time in high clock and last is time in low clock.
It is useful to see which activity uses more power as high clock is more power consuming.