がらくたネット

アフィリエイト広告を利用しています


cpulimit

cpulimit

linux上でCPUの稼動時間を制限するソフト

niceやulimitではCPU稼動時間をpercentageでは制御できず優先度(nice)や実行占有時間(ulimit)での制御となる

インストール

# cd /usr/local/src
# wget http://downloads.sourceforge.net/cpulimit/cpulimit-1.1.tar.gz
# tar zxvf cpulimit-1.1.tar.gz
# cd cpulimit-1.1
# make
# cp cpulimit /sbin

利用方法

cpulimitをオプションなしで実行するとヘルプ表示

Error: You must specify a target process
Usage: cpulimit TARGET [OPTIONS...]
   TARGET must be exactly one of these:
      -p, --pid=N        pid of the process
      -e, --exe=FILE     name of the executable program file
      -P, --path=PATH    absolute path name of the executable program file
   OPTIONS
      -l, --limit=N      percentage of cpu allowed from 0 to 100 (mandatory)
      -v, --verbose      show control statistics
      -z, --lazy         exit if there is no suitable target process, or if it dies
      -h, --help         display this help and exit

limit値の最大値はtopコマンドから取得する

マルチコアならば、最大数が100%ではなくコア数×100%が最大値となる