進程資源查看pidstat

作用

  查看全部或指定進程佔用系統資源的情況,如CPU,內存、設備IO、任務切換、線程等。pidstat首次運行時顯示自系統啓動開始的各項統計信息,之後運行pidstat將顯示自上次運行該命令以後的統計信息。用戶可以通過指定統計的次數和時間來獲得所需的統計信息。

使用

指定採樣週期和次數

命令格式:pidstat [option] interval [count]

pidstat 3 10

指定進程(-p)

pidstat -p pid 3 10

CPU使用情況(-u)

pidstat -u 3 10

內存使用情況(-r)

pidstat -r -u 3 10

IO統計信息(-d)

pidstat -d 3 10

上下文切換統計(-w)

//指定進程上下文切換情況
pidstat -p pid -w 3 10
//指定進程內各線程上下文切換情況
pidstat -p pid -t -w 3 10

參數說明:

  • cswch/s

  每秒自願上下文切換次數,次數變多說明任務都在等待資源,內存或者IO等存在問題;

Total number of voluntary context switches the task made per second. A voluntary context switch occurs when a task blocks because it requires a resource that is unavailable.

  • nvcswch/s

  每秒被動上下文切換次數,次數變多說明任務都在爭搶CPU資源,CPU成爲瓶頸;

Total number of non voluntary context switches the task made per second. A involuntary context switch takes place when a task executes for the duration of its time slice and then is forced to relinquish the processor.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章