![]() | This article only references primary sources.(July 2023) |
![]() | This article contains instructions, advice, or how-to content .(July 2023) |
mpstat is a computer command-line software used in Unix-type operating systems to report (on the screen) processor-related statistics. It is used in computer monitoring in order to diagnose problems or to build statistics about a computer's CPU usage.
The mpstat command writes to standard output activities for each available processor.
The mpstat command can be used both on SMP and UP machines, but in the latter, only global average activities will be printed.
$ mpstat <interval> <count>
Interval is the time in seconds between printing out a line of statistics. Count is the number of lines of output you want.
Note that the first line of output from mpstat (like iostat, vmstat, etc.) contains averages since system boot. The subsequent lines will show current values.
Different examples of output under different operating systems:
under Linux kernel 4.14 on a two CPU machine:
Linux 4.14.24.mptcp (hostname) 05/23/2018 _x86_64_ (2 CPU)03:51:19 PM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle03:51:20 PM all 2.51 0.00 2.01 0.00 0.00 0.00 0.00 0.00 0.00 95.4803:51:21 PM all 2.53 0.00 2.02 0.00 0.00 0.00 0.00 0.00 0.00 95.45
under Linux kernel 2.4:
$ mpstat Linux 2.4.21-32.ELsmp (linux00) 07/04/0710:26:54 CPU %user%nice%system%iowait%irq%soft%idleintr/s 10:26:54 all 0.07 0.00 0.16 8.48 0.00 0.09 91.18 165.49
under Solaris 11:
$ mpstat CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl 0 0 0 0 329 121 169 6 0 0 0 406 0 1 0 98
under AIX 6:
$ mpstat11System configuration: lcpu=8 ent=1.0 mode=Uncappedcpu min maj mpc int cs ics rq mig lpa sysc us sy wa id pc %ec lcs 0 8 0 0 182 336 102 0 0 100 1434 38 51 0 12 0.02 1.8 185 1 0 0 0 11 5 5 0 0 - 0 0 19 0 81 0.00 0.1 12 2 0 0 0 1 0 0 0 0 - 0 0 42 0 58 0.00 0.0 0 3 0 0 0 1 0 0 0 0 - 0 0 43 0 57 0.00 0.0 0 4 0 0 0 1 0 0 0 0 - 0 0 45 0 55 0.00 0.0 0 5 0 0 0 1 0 0 0 0 - 0 0 44 0 56 0.00 0.0 0 6 0 0 0 1 0 0 0 0 - 0 0 2 0 98 0.00 0.0 0 7 0 0 0 53 5 5 0 0 - 0 0 66 0 34 0.00 0.2 54 U - - - - - - - - - - - - 0 99 0.99 99.0 -ALL 8 0 0 251 346 112 0 0 100 1434 0 0 0 99 0.02 2.0 251
BogoMips is a crude measurement of CPU speed made by the Linux kernel when it boots to calibrate an internal busy-loop. An often-quoted definition of the term is "the number of million times per second a processor can do absolutely nothing".
Processor affinity, or CPU pinning or "cache affinity", enables the binding and unbinding of a process or a thread to a central processing unit (CPU) or a range of CPUs, so that the process or thread will execute only on the designated CPU or CPUs rather than any CPU. This can be viewed as a modification of the native central queue scheduling algorithm in a symmetric multiprocessing operating system. Each item in the queue has a tag indicating its kin processor. At the time of resource allocation, each task is allocated to its kin processor in preference to others.
In UNIX computing, the system load is a measure of the amount of computational work that a computer system performs. The load average represents the average system load over a period of time. It conventionally appears in the form of three numbers which represent the system load during the last one-, five-, and fifteen-minute periods.
A kernel panic is a safety measure taken by an operating system's kernel upon detecting an internal fatal error in which either it is unable to safely recover or continuing to run the system would have a higher risk of major data loss. The term is largely specific to Unix and Unix-like systems. The equivalent on Microsoft Windows operating systems is a stop error, often called a "blue screen of death".
In computing, scheduling is the action of assigning resources to perform tasks. The resources may be processors, network links or expansion cards. The tasks may be threads, processes or data flows.
Uptime is a measure of system reliability, expressed as the period of time a machine, typically a computer, has been continuously working and available. Uptime is the opposite of downtime.
The Filesystem Hierarchy Standard (FHS) is a reference describing the conventions used for the layout of Unix-like systems. It has been made popular by its use in Linux distributions, but it is used by other Unix-like systems as well. It is maintained by the Linux Foundation. The latest version is 3.0, released on 3 June 2015.
In computing, a loadable kernel module (LKM) is an object file that contains code to extend the running kernel, or so-called base kernel, of an operating system. LKMs are typically used to add support for new hardware and/or filesystems, or for adding system calls. When the functionality provided by an LKM is no longer required, it can be unloaded in order to free memory and other resources.
In computing, the process identifier is a number used by most operating system kernels—such as those of Unix, macOS and Windows—to uniquely identify an active process. This number may be used as a parameter in various function calls, allowing processes to be manipulated, such as adjusting the process's priority or killing it altogether.
In computing, time
is a command in Unix and Unix-like operating systems. It is used to determine the duration of execution of a particular command.
top is a task manager or system monitor program, found in many Unix-like operating systems, that displays information about CPU and memory utilization.
In Unix-like operating systems, /dev/random and /dev/urandom are special files that serve as cryptographically secure pseudorandom number generators (CSPRNGs). They allow access to a CSPRNG that is seeded with entropy from environmental noise, collected from device drivers and other sources. /dev/random typically blocked if there was less entropy available than requested; more recently it usually blocks at startup until sufficient entropy has been gathered, then unblocks permanently. The /dev/urandom device typically was never a blocking device, even if the pseudorandom number generator seed was not fully initialized with entropy since boot. Not all operating systems implement the same methods for /dev/random and /dev/urandom.
The proc filesystem (procfs) is a special filesystem in Unix-like operating systems that presents information about processes and other system information in a hierarchical file-like structure, providing a more convenient and standardized method for dynamically accessing process data held in the kernel than traditional tracing methods or direct access to kernel memory. Typically, it is mapped to a mount point named /proc at boot time. The proc file system acts as an interface to internal data structures about running processes in the kernel. In Linux, it can also be used to obtain information about the kernel and to change certain kernel parameters at runtime (sysctl).
The magic SysRq key is a key combination understood by the Linux kernel, which allows the user to perform various low-level commands regardless of the system's state. It is often used to recover from freezes, or to reboot a computer without corrupting the filesystem. Its effect is similar to the computer's hardware reset button but with many more options and much more control.
The Linux booting process involves multiple stages and is in many ways similar to the BSD and other Unix-style boot processes, from which it derives. Although the Linux booting process depends very much on the computer architecture, those architectures share similar stages and software components, including system startup, bootloader execution, loading and startup of a Linux kernel image, and execution of various startup scripts and daemons. Those are grouped into 4 steps: system startup, bootloader stage, kernel stage, and init process.
In the x86 computer architecture, HLT
(halt) is an assembly language instruction which halts the central processing unit (CPU) until the next external interrupt is fired. Interrupts are signals sent by hardware devices to the CPU alerting it that an event occurred to which it should react. For example, hardware timers send interrupts to the CPU at regular intervals.
nmon is a computer performance system monitor tool for the AIX and Linux operating systems. The nmon tool has two modes a) displays the performance stats on-screen in a condensed format or b) the same stats are saved to a comma-separated values (CSV) data file for later graphing and analysis to aid the understanding of computer resource use, tuning options and bottlenecks.
System Activity Report (sar
) is a Unix System V-derived system monitor command used to report on various system loads, including CPU activity, memory/paging, interrupts, device load, network and swap space utilization. Sar uses /proc
filesystem for gathering information.
Unix is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and others. Initially intended for use inside the Bell System, AT&T licensed Unix to outside parties in the late 1970s, leading to a variety of both academic and commercial Unix variants from vendors including University of California, Berkeley (BSD), Microsoft (Xenix), Sun Microsystems (SunOS/Solaris), HP/HPE (HP-UX), and IBM (AIX).
In computing, a status key is a keyboard key that causes an operating system and/or a program to output status information on a terminal when it is pressed. In the event that a program on a terminal produces no indications that it is running, typing the status key will reveal the program's state and activity. Older implementations produced only a quick one-line status report for the current job when the status key was pressed. Newer implementations support sending a signal to the current process to allow the application to report on status as well.