pidstat - Report Statistics for Linux Tasks (Processes): I/O, CPU, Memory, and More

Used to monitor processes and threads

Syntax

pidstat <OPTIONS> [INTERVAL] [COUNT]

-p ALL show all active and inactive processes

-d I/O statistics

-r memory usage statistics

Example

pidstat 现实所有活动进程

13时17分57秒     PID    %usr     %system    %guest     %CPU   CPU  Command
13时17分57秒       1       0.00       0.00                 0.00      0.00       1      init
13时17分57秒       82     0.00       0.00                 0.00      0.00       1      upstart-udev-br
  • PID - the process ID of the monitored task

  • %usr - this task’s CPU usage when executing at the user level (applications), regardless of nice priority. Note that the CPU time counted in this field does not include time spent in a virtual processor.

  • %system - this task’s CPU usage when running at the system level.

  • %guest - CPU usage the task spent on a virtual machine (running in a virtual processor).

  • %CPU - the task’s total CPU usage. In an SMP environment (multiple processors), if the -I option is given on the command line, CPU usage is divided by your number of CPUs.

  • CPU - the number of the processor currently running this task.

  • Command - the name of this task’s command.