pidstat(1)
Report per-process CPU, memory, I/O, and context switch statistics.
Synopsis
pidstat [OPTION]... [INTERVAL [COUNT]]Description
pidstat displays resource utilization data for individual processes and tasks running on the system. It reports CPU usage, memory consumption, I/O activity, and context switches per process at regular intervals, making it useful for process-level performance monitoring and troubleshooting.
Part of the sysstat package, pidstat samples process statistics from /proc at the specified interval. Without interval argument, it shows statistics since system boot. With interval and count, it displays multiple snapshots separated by the given time period in seconds.
Common options
| Flag | What it does |
|---|---|
-u | Display CPU utilization (default: user, system, guest, and wait time) |
-r | Display memory page faults and memory usage (RSS, VSZ) |
-d | Display I/O statistics (reads, writes, I/O wait time) |
-w | Display context switch rates (voluntary and involuntary) |
-p PID | Monitor specific process ID (comma-separated for multiple PIDs) |
-C pattern | Monitor only processes matching command name pattern |
-T {TASK|CHILD|ALL} | Report for specific task/thread type; ALL shows all threads |
-H | Display statistics for process and all its threads |
--human | Display numbers in human-readable format (KB, MB, GB) |
-e | Display command name and all arguments (full command line) |
-t | Include timestamp in each line of output |
Examples
Show CPU stats for all processes every 1 second for 5 samples
pidstat 1 5Monitor CPU usage of process 1234 at 1-second intervals
pidstat -u -p 1234 1Display memory stats for all Java processes every 2 seconds for 10 samples
pidstat -r -C java 2 10Show I/O statistics for process 5678 over 3 one-second intervals
pidstat -d -p 5678 1 3Monitor context switches for process 9999 and all its threads
pidstat -w -T ALL -p 9999 1Display CPU, memory, and I/O stats for all processes every 2 seconds continuously
pidstat -u -r -d 2 0