[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:

> Howdie, fellow Debianites!
>
> I've bee all over uncle G to crack this one, but to no avail. In short:  
> how would you go about launching a program when the computer is idle,  
> and launching another program when the computer stops being idle?  
> Specifically, I'd like my computer to switch CPU governors from  
> powersave to performance and vice versa, with "cpufreq-set --governor  
> foobar".
-- snip --
> Are there other -- preferably easier -- approaches to this? As you may  
> see, I'm not being picky as to how "idle" is defined: it may be no X  
> usage, it may be low average load, it may be no user activity, you  
> choose.
>
> Why I need this: my Pentium IV uses the p4_clockmod cpu scaling module,  
> which has a high latency. Using the (recommended) ondemand CPU governor  
> yields a very noticeable lag and leaves the CPU at low clocks even when  
> maximum performance is required. With the performance CPU governor, on  
> the other hand, the things feel real snappy again, but the fans start  
> to roar and heat to build up, so I'd really like it to switch to  
> powersave when not in use.

Do you know what your actual latency is?  When you have the ondemand
governor selected, you can check by 'cat
/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate' to get
the latency in microseconds.  You can write to that any value between
'sampling_rate_min' and 'sampling_rate_max' (in the same directory).
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.  If you have multiple cpus or cores then you will need to
change all of them.
-- 
Carl Johnson		carlj@peak.org


Reply to: