pidstat只显示正在使用资源的线程或进程
-d,显示磁盘使用情况
pidstat -d 2
12:16:55 PM PID kB_rd/s kB_wr/s kB_ccwr/s Command
12:16:57 PM PID kB_rd/s kB_wr/s kB_ccwr/s Command
12:16:59 PM 108040 0.00 2.00 0.00 oradba
12:16:59 PM PID kB_rd/s kB_wr/s kB_ccwr/s Command
12:17:01 PM PID kB_rd/s kB_wr/s kB_ccwr/s Command
PID
The identification number of the task being monitored.
kB_rd/s
Number of kilobytes the task has caused to be read from disk per second.
kB_wr/s
Number of kilobytes the task has caused, or shall cause to be written to disk per second.
kB_ccwr/s
Number of kilobytes whose writing to disk has been cancelled by the task. This may occur when the task truncates some dirty pagecache. In this case,
some IO which another task has been accounted for will not be happening.
Command
The command name of the task.
-p { pid [,…] | SELF | ALL },指定要显示的进程或线程所属进程,SELF即输出pidstat进程本身的资源使用情况,而ALL则是所有正在使用资源的进程
pidstat -p 150643 2
12:21:04 PM PID %usr %system %guest %CPU CPU Command
12:21:06 PM 150643 0.00 0.00 0.00 0.00 30 zabbix_agentd-2
12:21:08 PM 150643 0.00 0.00 0.00 0.00 30 zabbix_agentd-2
-t,显示线程信息
pidstat -t -p 150643 2
12:22:23 PM TGID TID %usr %system %guest %CPU CPU Command
12:22:25 PM 150643 - 0.00 0.00 0.00 0.00 30 zabbix_agentd-2
12:22:25 PM - 150643 0.00 0.00 0.00 0.00 30 |__zabbix_agentd-2
12:22:25 PM TGID TID %usr %system %guest %CPU CPU Command
12:22:27 PM 150643 - 0.00 0.00 0.00 0.00 30 zabbix_agentd-2
12:22:27 PM - 150643 0.00 0.00 0.00 0.00 30 |__zabbix_agentd-2
-u,显示CPU系信息
pidstat -p -u 150643 2
12:23:31 PM PID %usr %system %guest %CPU CPU Command
12:23:33 PM 150643 0.00 0.00 0.00 0.00 30 zabbix_agentd-2
12:23:35 PM 150643 0.00 0.00 0.00 0.00 30 zabbix_agentd-2
12:23:37 PM 150643 0.00 0.00 0.00 0.00 30 zabbix_agentd-2
-w,显示上下文切换信息
pidstat -p 150643 -w 2
12:25:40 PM PID cswch/s nvcswch/s Command
12:25:42 PM 150643 0.00 0.00 zabbix_agentd-2
12:25:44 PM 150643 0.00 0.00 zabbix_agentd-2