Comments (3)
this should even be the default. the user can issue background jobs using &
him/herself.
Edit: I dont know what I meant by that, foreground mode is already the default as mentioned by @joetwiddle below ??
from cpulimit.
I just use a bash function to do this:
function cpulimit () {
PID=$1
REST_TIME=${2}
REST_TIME=${REST_TIME:=1.5}
RUN_TIME=${3}
RUN_TIME=${RUN_TIME:=1}
if [ "$PID" ]; then
echo "Starting: $(date) pid=$PID rest=${REST_TIME} run=${RUN_TIME}."
while true; do
kill -SIGSTOP ${PID}
sleep ${REST_TIME}
kill -SIGCONT ${PID}
sleep ${RUN_TIME}
echo -n .
done
echo -e "Done: $(date)"
echo " • You can use this to continue a stopped process: kill -SIGCONT ${PID}"
else
echo "ERROR: You must supply pid."
echo "USAGE: cpulimit pid <rest-sec> <run-sec>"
echo "EXAMPLE: cpulimit 123456 1.5 1"
fi
}
It will output .
every cycle.
Just type ^c
to kill the process.
Note: only tested recently on MacOS, but I see no reason it should not work on Linux.
from cpulimit.
@jonathancross That shellscript is pretty neat! Although I don't think it quite addresses the issue.
I think what @gavv wants is to specify the command to execute on the command-line, so they don't have to do any mangement of PIDs.
This would work really well with other tools, including trickle:
nice -n 15 ionice -c 3 trickle -d 20 -u 20 cpulimit -l 10 ./foo bar
Wait a minute. This is supported! Since 688fc58. See the last line below:
Usage: cpulimit [OPTIONS...] TARGET
OPTIONS
...
TARGET must be exactly one of these:
-p, --pid=N pid of the process (implies -z)
-e, --exe=FILE name of the executable program file or path name
COMMAND [ARGS] run this command and limit it (implies -z)
I believe this issue can be closed.
from cpulimit.
Related Issues (20)
- centos 6中不起效果 HOT 1
- Question about affect of cpulimit
- How to set limit for child processes
- sytemd service file ? HOT 13
- Assertion `tmp_process.starttime == p->starttime' failed
- limit must be in the range of 1 to 000
- Expected Behavior of `--include-children` HOT 1
- Wrong logic in matching the process name
- performance versus setting CPU affinity
- Project location confusion HOT 5
- Set period of sleep-run
- s
- void
- Support CPU limits lower than 1 %
- how to use cpulimit in Android?
- two bugs were found and resolved, if any problems are welcome, feedback is welcome
- Could the tool of cpulimit control the cpu usage in range 0-100% exactly?e.g,I was running an endless loop of program,it costed 100% cpu usage,then,I tried to control the cpu usage near 90%,but failed!Why?
- cannot compile on Fedora 33 64bits HOT 2
- cpulimit will auto stop ? HOT 1
- May I ask how to solve this error ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cpulimit.