Skip to content

SYSTEM Cited by 1 source

pidstat

What it is

pidstat samples per-process CPU, memory, I/O, and context- switch statistics from /proc/<pid>/stat and /proc/<pid>/io. Ships in the sysstat package. The operationally-important difference from top: pidstat prints rolling one-line-per-sample output instead of clear-screen-refresh, so you can copy-paste its output into an incident record or a ticket.

Canonical invocation

pidstat 1

— one-second samples of CPU per process. Other modes: pidstat -d 1 (per-process disk I/O), pidstat -r 1 (memory), pidstat -w 1 (context switches).

Output columns (default)

UID  PID  %usr  %system  %guest  %CPU  CPU  Command
  • %CPU is the total across all CPUs — values above 100% mean the process is running on multiple cores.

Example from the Netflix checklist

07:41:03 PM     0      6521 1596.23    1.89    0.00 1598.11    27  java
07:41:03 PM     0      6564 1571.70    7.55    0.00 1579.25    28  java

Two Java processes at 1591% and 1583% CPU on a 32-CPU box — each consuming ~16 cores. Usually one hot flow per JVM (perhaps a GC spiral, a hot compute loop, or a thread-pool that's pinning itself to the carrier count).

When to reach for pidstat over top

  • Incident capture. You want to paste the output into a ticket / Slack — top's interactive redraw is hostile to copy-paste; pidstat's rolling lines are ideal.
  • Time-series patterns. pidstat 1 makes per-sample changes visible line-by-line; top hides transitions across screen refreshes.
  • Specific metrics. -d / -r / -w give targeted I/O / memory / context-switch views without parsing top's unified screen.

Interpretation rule from the Netflix checklist

Pidstat is a little like top's per-process summary, but prints a rolling summary instead of clearing the screen. This can be useful for watching patterns over time, and also recording what you saw (copy-n-paste) into a record of your investigation.

Seen in

Last updated · 319 distilled / 1,201 read