1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【ワンライナー】CPUのコア数分、空のループを回してCPUを100%にしたい、メモ

Posted at

はじめに

Macbookで CPU使用率100% にしたいなぁ

Macbookの消費電力を多くして、アダプタの電圧の上限を知りたいなぁ

ということから、CPUのコア数分、空のループを回してCPUを100%にしたい、メモ

環境

bash

CPUのコア数分、空のループを回す

for i in $(seq 1 $(nproc)); do (while : ; do : ; done) & done

for i in $(seq 1 $(nproc)); do (yes > /dev/null) & done

とかでもできるけど、 yes > /dev/null より while : ; do : ; done のほうが消費電力が大きかったので採用

とめかた

kill $(jobs -p)

jobs -p でプロセスIDのみが取れない場合は、kill $(jobs -p | awk '{print $2}') とかすればいい
それか、fg して ctrl+c を繰り返すとか

さいごに

かんたんでしたね

参考リンク

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?