Laxmikant Laxmikant - 1 year ago 81
Python Question

How to use cpulimit to a python script

From the answer to my old question, I gone through this and some more from google. But I did not understand, how can I

for a python script.
Followings are my try:

cpulimit --limit 20 --exe ./

cpulimit --limit 20 --exe "python"

cpulimit -P ./ -l 20

and some more...

But in each case getting warning :

Warning: no target process found. Waiting for it...

I could not find any documentation to explain running a python script with
. I also gone through these too but did not get any clue

Answer Source

Instead of executing a program, cpulimit limits the cpu usage of running process. You need to run the program separately.

Run the program normally:


Open other terminal, and run the following command (pgrep ... will give you the pid of the previous command)

cpulimit --limit=10 -p `pgrep -f`
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download