
我正在轉換(使用 ImageMagick)圖像檔案目錄(在 shell 中使用 bash for 循環)。
我注意到「轉換」佔用了大量 CPU 使用率(88% 及以上)。但是,如果我嘗試使用 cpulimit 限制它
cpulimit -l 10 -e convert
它回應
Warning: no target process found. Waiting for it...
即使它在ps
和中可見top
答案1
cpulimit 透過查看 /proc/pppp/exe (其中 pppp 是 pid)來尋找進程,這是可執行檔的鏈接,對於某些進程,它不包含您期望的名稱
我在 firefox-bin 中遇到了同樣的問題,ps 給出:
dave 4117 3595 4 04:49 ? 00:11:54 /usr/lib/iceweasel/firefox-bin
但
ls -l /proc/4117/exe
lrwxrwxrwx 1 dave dave 0 Jan 9 13:50 /proc/4117/exe -> /usr/lib/xulrunner-10.0/xulrunner-stub
在我的系統上,轉換是 /usr/bin/convert.im6 所以:
cpulimit -l 10 -e convert.im6
對我有用。