首页 > 代码库 > pidstat

pidstat

pidstat

- Report statistics for Linux tasks.

[root@node85 ~
]# pidstat Linux 2.6.32-573.el6.x86_64 (node85) 01/31/2017 _x86_64_ (1 CPU) 09:57:53 PM PID %usr %system %guest %CPU CPU Command 09:57:53 PM 1 0.00 0.01 0.00 0.01 0 init 09:57:53 PM 6 0.00 0.00 0.00 0.00 0 watchdog/0 09:57:53 PM 7 0.00 0.05 0.00 0.05 0 events/0 09:57:53 PM 16 0.00 0.00 0.00 0.00 0 sync_supers 09:57:53 PM 17 0.00 0.00 0.00 0.00 0 bdi-default 09:57:53 PM 19 0.00 0.00 0.00 0.00 0 kblockd/0 09:57:53 PM 35 0.00 0.01 0.00 0.01 0 khugepaged 09:57:53 PM 230 0.00 0.00 0.00 0.00 0 mpt_poll_0 09:57:53 PM 446 0.00 0.00 0.00 0.00 0 jbd2/sda2-8 09:57:53 PM 468 0.00 0.00 0.00 0.00 0 flush-8:0 09:57:53 PM 541 0.00 0.00 0.00 0.00 0 udevd 09:57:53 PM 756 0.00 0.00 0.00 0.00 0 vmmemctl 09:57:53 PM 1263 0.00 0.00 0.00 0.00 0 auditd 09:57:53 PM 1285 0.00 0.00 0.00 0.00 0 rsyslogd 09:57:53 PM 1404 0.00 0.00 0.00 0.00 0 hald 09:57:53 PM 1553 0.00 0.00 0.00 0.00 0 master 09:57:53 PM 1594 0.00 0.00 0.00 0.00 0 crond 09:57:53 PM 1648 0.00 0.01 0.00 0.01 0 sshd 09:57:53 PM 1650 0.00 0.00 0.00 0.00 0 bash 09:57:53 PM 1814 0.00 0.00 0.00 0.00 0 bash 09:57:53 PM 1981 0.00 0.00 0.00 0.01 0 python

 

常用参数

-r     Report page faults and memory utilization.
-u     Report CPU utilization.
-d     Report I/O statistics
-p     pid

 

以pid号统计其内存、CPU、I/O

[root@node85 ~]# pidstat -r -d -u -p 1981
Linux 2.6.32-573.el6.x86_64 (node85)    01/31/2017      _x86_64_        (1 CPU)

10:00:33 PM       PID    %usr %system  %guest    %CPU   CPU  Command
10:00:33 PM      1981    0.00    0.00    0.00    0.01     0  python
#Virtual Size: The virtual memory usage of entire task in kilobytes.
#Resident Set Size: The non-swapped physical memory used by the task in kilobytes.

10:00:33 PM PID minflt/s majflt/s VSZ RSS %MEM Command 10:00:33 PM 1981 0.14 0.00 179668 7960 0.79 python 10:00:33 PM PID kB_rd/s kB_wr/s kB_ccwr/s Command 10:00:33 PM 1981 0.00 0.00 0.00 python
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.

 

pidstat