ablog

不器用で落着きのない技術者のメモ

CPU使用率を 100% にする Perl ワンライナー

$ perl -e 'while(1) {}'


これも id:sh2 さんに教えていただきました。ありがとうございました。

yoheia: CPU、メモリの使用率の監視のテストのため、使用率を上げたいんだけど、スマートなやり方ないかな?誰か教えて。

posted at 12:45:28

sh2nd: @yoheia perl -e 'while(1) {}' すごいてきとうですいませんw

posted at 12:49:34

beakmark: @yoheia WIndowsなら CPUGRAB.exe でいけるのでは?

posted at 12:48:37

Windows なら CPUGRAB.exe というのがあるらしいです。id:beakmark さんありがとうございます。


追記(2010/01/12):
実行例

# プロセス起動
$ for i in {1..4}
do
perl -e 'while(1){}' &
done

#プロセス終了
$ ps -ef|perl -lane '/perl -e while\(1\)\{\}/ and print $F[1]'|xargs kill