[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Support for SIGSTOP/SIGCONT in nice?
From: |
Bob Proulx |
Subject: |
Re: Support for SIGSTOP/SIGCONT in nice? |
Date: |
Fri, 31 Mar 2006 08:54:12 -0700 |
User-agent: |
Mutt/1.5.9i |
Jim Meyering wrote:
> Simon Josefsson <address@hidden> wrote:
> ...
> > Still, maybe not all programs have similar rate-limiting features, so
> > that this nice-extension may be useful anyway...
>
> I agree. Maybe even as a separate program, for when you start something
> important and somehow resource-intensive, so that you can regulate its
> impact after the fact (via some new tool with a --pid=PID option).
Using the loadwatch program the following works.
perl -e '$t=1; while (1) { $t = sqrt $t }' & # run a cpu bound job
[1] 18365
loadwatch -d 10 -l 0.4 -h 0.5 -p 18365 # watch it, stop it, run it
Fri Mar 31 08:48:30 2006: load too high, stopping.
Fri Mar 31 08:49:00 2006: load low, continuing.
Fri Mar 31 08:49:20 2006: load too high, stopping.
Fri Mar 31 08:50:20 2006: load low, continuing.
loadwatch [-d <time>] [-h <load>] [-l <load>] [-n <copies>] [-p <pid>] [--
<command>]
-d <int> load sampling interval (10 seconds)
-h <float> high load mark (1.25)
-l <float> low load mark (0.25)
-n <copies> number of children to fork (1)
-u <filename> file that will be used to externally control a
loadwatch process.
-p <pid> pid of process to control (loadwatch will actually
send signals to the group containing this pid)
NOTE: -p and <command> are mutually exclusive, but one has to be
specified.
Bob
P.S. And of course I am aware of $! for getting the pid.
Re: Support for SIGSTOP/SIGCONT in nice?, Andreas Schwab, 2006/03/29