Author Topic: Small Useful Informations  (Read 4986 times)

ptoki

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • http://
Small Useful Informations
« on: April 22, 2010, 12:28:03 pm »
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.

ptoki

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • http://
Small Useful Informations
« Reply #1 on: April 22, 2010, 06:03:17 pm »
Another small utility I made:
#!/bin/bash
while true
do
 tmp2=$tmp
 fmp2=$fmp
 smp2=$smp
 
 tmp=`cat /sys/devices/system/cpu/cpu0/cpufreq/stats/total_trans`
 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"
 sleep 5
 done


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.