[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Running a program when computer enters/exits idle state



Klistvud <quotations@aliceadsl.fr> writes:

> Dne, 02. 06. 2010 18:33:21 je Carl Johnson napisal(a):
>> 
>> I suspect any manual selection you figure out will be slower than
>> that.  On my Athlon II computer the default latency is 80000 (80msec)
>> which is faster than I really need, so I actually slow it down a
>> little.
>
> No such luck here. My sampling_rate_min is 500000 (yes, half a second),  
> so even lowering the latency from 1s to 0.5s, as you can imagine,  
> doesn't help much: it still takes almost a second just to switch from  
> one tab to the next in Iceweasel. While such common GUI tasks are so  
> slow that I can almost hear them crying for help, my 3 GHz CPU remains  
> stubbornly at 375 MHz (as checked via "watch cpufreq-info"). The  
> ondemand governor obviously just can't be bothered.

My old Athlon 64 was similar to that, so I had a script setup to
quickly switch to high speed, and a timout option.  I would use that
at times when I wanted to run several small programs so they would
avoid the delay, but then if I forgot it would drop the speed back.
They aren't very long, so I will list them here.  Both of these must
be run by sudo since cpufreq-set requires root permissions.

I had buttons setup on the desktop panel so I could just press the
fast button to run 'sudo fast -t 300' for 5 minutes of fast
operation. That is definitely crude, but it worked for most things I
wanted.  I also had a slow program, but that was only because that cpu
would sometimes get stuck in a faster speed.

---- start /usr/local/bin/fast ---
#!/bin/sh

unset timeout
freq=`cpufreq-info -f`

while getopts "t:" opt
do
  case $opt in
    t)timeout=$OPTARG
      ;;
    *) echo usage: $0 [-t <seconds>]
      exit 1
      ;;
  esac
done

cpufreq-set -g performance

if [ $timeout ]
then
    (sleep $timeout;ondemand)&
fi
exit 0
---- end /usr/local/bin/fast ---

---- start /usr/local/bin/ondemand ----
#!/bin/sh

cpufreq-set -g ondemand

exit 0
---- end /usr/local/bin/ondemand ----

-- 
Carl Johnson		carlj@peak.org


Reply to: