[Linux] Several commands to view the status of memory and CPU

top:
 The Top command displays the actual CPU usage. By default, it displays the task information that occupies the CPU on the server and refreshes it every 5 seconds.
Simple study notes for several commands to view the status of memory and CPU
The following is the output flag:
us: user space accounts for 100% of the CPU
sy: Percentage of kernel space in CPU
ni: The percentage of CPU occupied by processes whose priority has been changed in the user process space
id: The percentage of idle processes in the CPU
wa: waiting for input and output as a percentage of CPU
PID: Process flag
USER: the user name of the process owner
PR: The priority of the process
NI: nice level
VIRT: The total amount of virtual memory used by the process ( VIRT = SWAP + RES )
RES: Physical memory used by the process that has not been swapped out
SHR: The size of shared memory
S: Process status
%CPU: The shared CPU uses
%MEM; the shared physical memory
TIME+: the time the process occupies the CPU, the unit is 1/100 second
COMMAND: the command line to start the task (including parameters)
A brief introduction to this, more detailed information can be obtained through man
vmstat: The
vmstat command is the most common Linux/Unix monitoring tool. It can display the status of the server at a given time interval, including the server's CPU usage, memory usage, virtual memory exchange status, IO read and write status. Generally, the use of the vmstat tool is accomplished through two digital parameters. The first parameter is the number of sampling intervals, in seconds, and the second parameter is the number of samples. For example, thefollowing is the output flag:r: means Waiting for the number of processes in the cpu run queue
Simple study notes for several commands to view the status of memory and CPU

b: indicates the number of blocked processes
swpd: indicates the size of the virtual memory that has been used. If it is greater than 0, the physical memory is not enough.
free: Free physical memory size.
buff: Used to store the contents of the directory and the permission cache.
cache: cache
si: The size of the virtual memory read from the disk per second. If this value is greater than 0, it means that the physical memory is not enough or the memory is leaked. It is necessary to find the memory-consuming process to solve it.
so: The size of the virtual memory written to disk per second, if it is greater than 0, the same as above
bi: the number of blocks accepted by the block device per second
bo: the number of blocks sent by the block device per second
in: The number of interrupts per second of the cpu, including clock interrupts.
cs: The number of context switches per second.
us: CPU time of user program running
sy: CPU running time of the kernel program
id: system idle cpu time
wa: IO waiting time for cpu
sar -q:
The process queue length and average load status are monitored every 10 seconds. You can also enter the number to display the number of times to monitor.
Simple study notes for several commands to view the status of memory and CPU
The following are the output signs:
runq-sz: the length of the run queue.
plist-sz: The number of processes in the current system.
ldavg-1: the average value of the past 1 minute
ldavg-5: the average of the past 5 minutes
idavg-15: Average of the past 15 minutes
sar -w: View the average number of context switches and the average value of process creation;
-------------------------------------------------------------------------------------------------------------------
View cpu utilization:
mpstat:
mpstat shows all cpu
mpstat -P 0 1: Indicates that the information of cpu 0 is displayed every second
Simple study notes for several commands to view the status of memory and CPU
usr, nice, sys, iowait, idle are basically the same as the previous ones.
irp: show interrupted
soft: soft interrupt
steal: stolen by a virtual machine
guest: used by the virtual machine
idle: idle
iostat:
Used to report cpu statistics and input and output statistics
-c means cpu, -c 16 is also sampled six times every second, and the remaining options can be obtained through man
Simple study notes for several commands to view the status of memory and CPU
dstat:
dstat is a multifunctional product that can replace vmstat, iostat, netstat and ifstat commands. dstat overcomes the limitations of these commands and adds some additional functions, adds monitoring items, and becomes more flexible. dstat can easily monitor the operating status of the system and be used for benchmarking and troubleshooting.
-–Disk-util: Display the busy status of the disk at a certain time
-–freespace: Display the current disk space usage
-–proc-count: Display the number of running programs
-–top-bio: Point out the process with the largest block I/O
-–Top-cpu: Graphically displays the process with the largest CPU usage
-–top-io: Displays the process with the largest normal I/O
-–top-mem: Displays the process with the most memory
These can be used at the same time
Simple study notes for several commands to view the status of memory and CPU
The rest can be viewed by man
Regarding the binding of the cpu and the process, I will not introduce it here, use the taskset command.

Guess you like

Origin blog.csdn.net/qq_44065303/article/details/110928749