Bob Proulx <[EMAIL PROTECTED]> writes: > > Hi, > > > > I'd like to propose two new features to "sleep": > > > > 1) Sub-Second resolution > > GNU sleep version 2.0a and later implements that. The NEWS file > contains: > > [2.0a] > * sleep accepts floating point arguments on command line
Sorry. I checked the production version. [...] > You could 'time' the loop payload, extract the real time, subtract > that from the desired loop time, guarentee that it is non-negative, > sleep for that value. Implementation left as an excercise to the > reader. :-) [Hint: The "time --format='%e\n'" option would probably > be useful.] Mostly correct. It does not account for the loop administration time and the test function. Your approach is a lot more to type. The "sleep -m" approach allows for a different way of thinking. > > A new program could supplement "nice". In some (rare) cases you want > > to control the maximum CPU load a program can generate. It could be > > dome via signals. To allow a maximum CPU load of 0.5 for a program > > you can send a TSTOP signal , wait 0.5 seconds, send CONT and wait > > 0.5 seconds and so on. > > > > I know that programs can intercept signals but it'll work for most > > programs. > > low_priority_task_to_run & > while sleep 0.5; do > kill -STOP $! || break > sleep 0.5 > kill -CONT $! || break > done > > Interesting... That's what I'm doing to run setiathome on my laptop to keep the CPU fan quiet. It's OK for non-interactive programms. But interactive programms need much lower cycle times (e. g. 0.1 sec) to run smoothly. This causes a lot of overhead to start the "sleep" binary all the time. A C function is much cheaper resourcewise. Johannes Nie� _______________________________________________ Bug-sh-utils mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-sh-utils
