API for "nice" sleep

Jean-Marc Ranger jmranger at ncf.ca
Tue May 22 18:04:37 PDT 2007


Sorry for a slightly off-topic post.

I'm currently investigating cpudyn[0], a nice simple userspace governor 
that is fairly high in my powertop[1] interrupt source.

Code structure is fairly simple:
while(true) {
   Read("/proc/stat");
   ComputeLoad();
   UpdateGovernor();
   usleep(delay);
}
with delay being configurable, 100ms being the default.

Beside discussing whether 100ms is the appropriate delay, I'm wondering 
whether there would be a nicer way to get periodic CPU time without 
forcing a wake-up.  Something like "call me every now and then, not 
faster than x but not slower than y, at kernel's convenience".
It's the same basic idea than the 2.6.21 patch available at [2], but in 
userland.  Suggestions ?

Thanks,

Jean-Marc Ranger


[0] http://mnm.uib.es/gallir/cpudyn/
[1] http://linuxpowertop.org/
[2] http://linuxpowertop.org/patches/kernel-2.6.21.patch




More information about the Power mailing list