pidstat

说明

The pidstat command reports CPU, disk I/O, memory usage by processes or threads, including the percentage of CPU utilization breakdown into user-space and kernel-space. The command can also monitor the children of those processes and threads

选项说明

选项
说明

-t

显示进程的每个线程统计信息

-d

显示进程的磁盘统计信息。只有 root 才能访问其他用户拥有的进程的统计信息

-r

显示页面故障和进程的内存利用率

-u

显示进程的 CPU 利用率。这是默认值。

使用示例

查看指定 pid 进程状态

# 查看 pid 为 1 的进程的状态信息
pidstat -p 1
Linux 5.14.0-362.8.1.el9_3.x86_64 (rocky1)      07/20/2024      _x86_64_        (2 CPU)

09:15:02 PM   UID       PID    %usr %system  %guest   %wait    %CPU   CPU  Command
09:15:02 PM     0         1    0.00    0.00    0.00    0.00    0.00     0  systemd

查看 1 号进程,间隔1s,连续显示3次

查看 1 、2 号进程,间隔1s,连续显示3次

Last updated