0

In cpulimit

-l, --limit=N

percentage of CPU allowed from 1 up. Usually 1 - 100, but can be higher on multi-core CPUs. (mandatory)

What option argument can I give to -l when I want a process to have no limit on cpu usage?

Is it $(($(nproc)*100))?

(I am writing a script, which accepts a command line argument and assigns it as an option argument to -l. In case the command line argument is not specified to the script, I would like to provide a default value, which represents no limit.)

Thanks.

  • 4
    When I want no limit, I don't start cpulimit in the first place. What's good in running the tool in this situation? – Kamil Maciorowski Dec 1 '18 at 19:20
  • Tim, IMHO it can be up to <number of cores>*100 – Romeo Ninov Dec 1 '18 at 21:15
1

Based on Kamil's comment (don't use cpulimit when not needed), I would just do domething like this in your script:

cmd=<command you want to run>

limit=<your cpu limit. can be empty>

if [ -z "$limit" ]; then
    cpulimit_cmd=""
else
    cpulimit_cmd="cpulimit -l $limit"
fi

$cpulimit_cmd $cmd

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.