.TH CPULIMIT "1" "June 2012" "cpulimit" "User commands" .SH NAME cpulimit -- limits the CPU usage of a process .SH SYNOPSIS .B cpulimit \fI[TARGET\fR] \fR[\fIOPTIONS\fR...] .SH DESCRIPTION .P \fITARGET \fRmust be exactly one of these: .TP \fB\-p\fR, \fB\-\-pid\fR=\fIN\fR pid of the process .TP \fB\-e\fR, \fB\-\-exe\fR=\fIFILE\fR name of the executable program file .TP \fB\-P\fR, \fB\-\-path\fR=\fIPATH\fR absolute path name of the executable program file .P \fIOPTIONS\fR .TP \fB\-b\fR, \fB\-\-background\fR run cpulimit in the background, freeing up the terminal .TP \fB\-c\fR, \fB\-\-cpu\fR specify the number of CPU cores available. Usually this is detected for us. .TP \fB\-l\fR, \fB\-\-limit\fR=\fIN\fR percentage of CPU allowed from 1 up. Usually 1 - 100, but can be higher on multi-core CPUs. (mandatory) .TP \fB\-v\fR, \fB\-\-verbose\fR show control statistics .TP \fB\-z\fR, \fB\-\-lazy\fR exit if there is no suitable target process, or if it dies .TP \fB\-h\fR, \fB\-\-help\fR display this help and exit .SH EXAMPLES Assuming you have started \fB`foo \-\-bar`\fR and you find out with \fItop\fR(1) or \fIps\fR(1) that this process uses all your CPU time you can either .TP \[sh] \fBcpulimit \-e foo \-l 50\fR limits the CPU usage of the process by acting on the executable program file (note: the argument "\-\-bar" is omitted) .TP \[sh] \fBcpulimit \-p 1234 \-l 50\fR limits the CPU usage of the process by acting on its PID, as shown by \fIps\fR(1) .TP \[sh] \fBcpulimit \-P /usr/bin/foo \-l 50\fR same as \fI\-e\fR but uses the absolute path name .TP \[sh] \fB/usr/bin/someapp \& .TP \[sh] \fBcpulimit \-p $! \-l 25 \-b\fR Useful for scripts where you want to throttle the last command run. .TP \[sh] \fBcpulimit \-l 20 firefox\fR Launch Firefox web browser and limit its CPU usage to 20% .TP \[sh] \fBcpulimit \-c 2 \-p 12345 \-l 25\fR The \fB\-c\fR flag sets the number of CPU cores the program thinks are available. Usually this is detected for us, but can be over-ridden. .SH NOTES .IP \(bu 4 cpulimit always sends the SIGSTOP and SIGCONT signals to a process, both to verify that it can control it and to limit the average amount of CPU it consumes. This can result in misleading (annoying) job control messages that indicate that the job has been stopped (when actually it was, but immediately restarted). This can also cause issues with interactive shells that detect or otherwise depend on SIGSTOP/SIGCONT. For example, you may place a job in the foreground, only to see it immediately stopped and restarted in the background. (See also .) .IP \(bu 4 When invoked with the \fI\-e\fR or \fI\-P\fR options, cpulimit looks for any process under /proc with a name that matches the process name argument given. Furthermore, it uses the first instance of the process found. To control a specific instance of a process, use the \fI\-p\fR option and provide a PID. .IP \(bu 4 The current version of cpulimit assumes the kernel HZ value 100. .SH AUTHOR This manpage was written for the Debian project by gregor herrmann but may be used by others.