MPSTAT(1)

๐Ÿ’… MPSTAT(1) โ€” the Linux User's Manual, but make it a group chat

okay bestie, sit down, hydrate, because we're about to talk about mpstat โ€” the processor-statistics girlie from the Linux User's Manual. she's giving โœจmain character energyโœจ and she has OPINIONS about your CPUs.


๐ŸŒธ NAME ๐ŸŒธ

mpstat โ€” report processors related statistics. that's it, that's the whole job. she watches your CPUs and tells you what they've been up to. nosy? yes. iconic? also yes. ๐Ÿ‘‘


โœจ SYNOPSIS โœจ

mpstat [ -A ] [ --dec={ 0 | 1 | 2 } ] [ -H ] [ -n ] [ -U ] [ -u ] [ -T ]
[ -V ] [ -I { keyword[,...] | ALL } ] [ -N { node_list | ALL } ] [ -o
JSON ] [ -P { cpu_list | ALL } ] [ interval [ count ] ]

like, so many little flags. each one is a vibe. we'll get to all of them, don't worry ๐Ÿซถ


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

mpstat writes to standard output the activities for each available processor, and processor 0 is the first one. yes, we start counting at zero, we're Unix, that's just how it is ๐Ÿ’€

Global average activities among all processors are also reported, so you get the group-chat summary and the individual DMs.

She works on both SMP and UP machines โ€” but on a UP machine, only global average activities will be printed. so on UP she's like "okay there's one of you, here's the average, bye" ๐Ÿ™ˆ

If no activity has been selected, then the default report is the CPU utilization report.

Now, the parameters, bestie, listen up:

  • the interval parameter specifies the amount of time in seconds between each report. a value of 0 (or no parameters at all) means processor statistics are reported for the time since system startup (boot). like, "since forever, babe."
  • the count parameter can be specified in conjunction with the interval parameter if that one isn't set to zero. the value of count determines the number of reports generated at interval seconds apart.
  • if the interval parameter is specified without the count parameter, the mpstat command generates reports continuously. forever. no stopping. she will simply keep talking. ๐Ÿ˜ญ

๐ŸŽ€ OPTIONS ๐ŸŽ€

  • -A โ€” this option is equivalent to specifying -n -u -I ALL. it also implies specifying -N ALL -P ALL unless these options are explicitly set on the command line. it's the "give me everything" button. the girl who orders one of each.
  • --dec={ 0 | 1 | 2 } โ€” specify the number of decimal places to use (0 to 2, default value is 2). pick your precision, diva. ๐Ÿ’…
  • -H โ€” also detect and display statistics for physically hotplugged vCPUs. new CPU just dropped. ๐Ÿ”ฅ
  • -I { keyword[,...] | ALL } โ€” report interrupts statistics. possible keywords are CPU, SCPU, and SUM.
    • with the CPU keyword, the number of each individual interrupt received per second by the CPU or CPUs is displayed. interrupts are those listed in /proc/interrupts file.
    • with the SCPU keyword, the number of each individual software interrupt received per second by the CPU or CPUs is displayed. this option works only with kernels 2.6.31 and later. software interrupts are those listed in /proc/softirqs file.
    • with the SUM keyword, the mpstat command reports the total number of interrupts per processor. the following values are displayed:
      • CPU โ€” processor number. the keyword all indicates that statistics are calculated as averages among all processors.
      • intr/s โ€” show the total number of interrupts received per second by the CPU or CPUs.
    • the ALL keyword is equivalent to specifying all the keywords above and therefore all the interrupts statistics are displayed. collect them all, pokรฉmon style ๐ŸŽ€
  • -N { node_list | ALL } โ€” indicate the NUMA nodes for which statistics are to be reported. node_list is a list of comma-separated values or range of values (e.g., 0,2,4-7,12-). note that node all is the global average among all nodes. the ALL keyword indicates that statistics are to be reported for all nodes.
  • -n โ€” report summary CPU statistics based on NUMA node placement. the following values are displayed:
    • NODE โ€” logical NUMA node number. the keyword all indicates that statistics are calculated as averages among all nodes.
    • all the other fields are the same as those displayed with option -u (see below). yes, scroll down. we get there.
  • -o JSON โ€” display the statistics in JSON (JavaScript Object Notation) format. JSON output field order is undefined, and new fields may be added in the future. so don't you dare hardcode a field order and then act surprised, bestie ๐Ÿ™ˆ
  • -P { cpu_list | ALL } โ€” indicate the processors for which statistics are to be reported. cpu_list is a list of comma-separated values or range of values (e.g., 0,2,4-7,12-). note that processor 0 is the first processor, and processor all is the global average among all processors. the ALL keyword indicates that statistics are to be reported for all processors. offline processors are not displayed. they're not invited to the party ๐Ÿ’€
  • -T โ€” display topology elements in the CPU report (see option -u below). the following elements are displayed:
    • CORE โ€” logical core number.
    • SOCK โ€” logical socket number.
    • NODE โ€” logical NUMA node number.
  • -U โ€” display timestamp (UTC โ€” Coordinated Universal Time) in seconds from the epoch. raw, unixy, unbothered. โญ
  • -u โ€” report CPU utilization. the following values are displayed:
    • CPU โ€” processor number. the keyword all indicates that statistics are calculated as averages among all processors.
    • %usr โ€” show the percentage of CPU utilization that occurred while executing at the user level (application).
    • %nice โ€” show the percentage of CPU utilization that occurred while executing at the user level with nice priority.
    • %sys โ€” show the percentage of CPU utilization that occurred while executing at the system level (kernel). note that this does not include time spent servicing hardware and software interrupts.
    • %iowait โ€” show the percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request.
    • %irq โ€” show the percentage of time spent by the CPU or CPUs to service hardware interrupts.
    • %soft โ€” show the percentage of time spent by the CPU or CPUs to service software interrupts.
    • %steal โ€” show the percentage of time spent in involuntary wait by the virtual CPU or CPUs while the hypervisor was servicing another virtual processor.
    • %guest โ€” show the percentage of time spent by the CPU or CPUs to run a virtual processor.
    • %gnice โ€” show the percentage of time spent by the CPU or CPUs to run a niced guest.
    • %idle โ€” show the percentage of time that the CPU or CPUs were idle and the system did not have an outstanding disk I/O request.
  • -V โ€” print version number then exit. short and sweet, she said what she said. ๐Ÿ’…

๐ŸŒˆ ENVIRONMENT ๐ŸŒˆ

the mpstat command takes into account the following environment variable:

  • S_COLORS โ€” by default statistics are displayed in color when the output is connected to a terminal. use this variable to change the settings. possible values for this variable are never, always or auto (the latter is equivalent to the default settings).
please note that the color (being red, yellow, or some other color) used to display a value is not indicative of any kind of issue simply because of the color. it only indicates different ranges of values. so no spiraling just because something's red, okay? it's just a range. breathe. ๐Ÿซถ
  • S_COLORS_SGR โ€” specify the colors and other attributes used to display statistics on the terminal. its value is a colon-separated list of capabilities that defaults to I=32;22:N=34;1:W=35;1:X=31;1:Z=34;22. supported capabilities are:
    • I= โ€” SGR (Select Graphic Rendition) substring for CPU number.
    • N= โ€” SGR substring for non-zero statistics values.
    • W= (or M=) โ€” SGR substring for percentage values in the range from 75% to 90% (or in the range 10% to 25% depending on the metric's meaning).
    • X= (or H=) โ€” SGR substring for percentage values greater than or equal to 90% (or lower than or equal to 10% depending on the metric's meaning).
    • Z= โ€” SGR substring for zero values.
  • S_TIME_FORMAT โ€” if this variable exists and its value is ISO then the current locale will be ignored when printing the date in the report header. the mpstat command will use the ISO 8601 format (YYYY-MM-DD) instead. the timestamp will also be compliant with ISO 8601 format. organized. punctual. a Virgo. ๐ŸŽ€

๐Ÿงš EXAMPLES ๐Ÿงš

mpstat 2 5

display five reports of global statistics among all processors at two second intervals.

mpstat -P ALL 2 5

display five reports of statistics for all processors at two second intervals.


๐Ÿ’€ BUGS ๐Ÿ’€

/proc filesystem must be mounted for the mpstat command to work. no /proc, no vibes. that's the whole bug note. ๐Ÿซถ


๐Ÿ“ FILES ๐Ÿ“

/proc contains various files with system statistics.


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Sebastien Godard (sysstat <at> orange.fr) โ€” the literal legend who made this whole thing happen. respect. ๐Ÿซก


๐ŸŒŸ SEE ALSO ๐ŸŒŸ

sar(1), pidstat(1), iostat(1), vmstat(8)


and that's the whole page, bestie ๐Ÿ’– this one shipped on Linux and it's dated JULY 2025 โ€” so go forth, run mpstat, and remember: the color being red means nothing, it's just a range. slay. โœจ๐Ÿฆ‹๐Ÿ’…

๐Ÿ“ฆ where this page comes from