Top Common performance analysis tool for real-time display of resource usage for each process in the system
#top
-C: Displays the entire command line instead of just displaying the command name
-D: Specifies the interval between every two times the screen information is refreshed. Of course the user can use the s interactive command to change it.
-P: Monitors only the state of a process by specifying the monitoring process ID.
-Q: This option will cause top to refresh without any delay. If the calling program has Superuser privileges, top will
Run at the highest possible priority level.
-S: Specify cumulative mode
-S: Causes the top command to run in Safe mode. This removes the potential danger of interactive commands.
-I: Make top not show any idle or zombie processes.
Interactive Commands: You can enter the following related characters directly after the top command enters the interface :
H or? : Displays the help screen and gives a brief summary of the commands.
C: Toggle display command name and full command line. Displays the complete command. Very useful.
Sort by: P: Sorts according to the percentage size of CPU usage.
M: Sorts based on the size of the resident memory.
T: Sort by Time/cumulative time.
K: Terminates a process. Prompts the input process PID, as well as the signal, the default 15 signal; 9 forces the end of the process. This command is masked in safe mode.
I: Ignore idle and zombie processes. Switch-mode command.
Q: Quit the program.
R: Reschedule the priority level of a process. Prompt for process PID and process priority values to be set
Entering a positive value lowers the priority and, conversely, it gives the process a higher priority. The default value is 10.
S: Switch to cumulative mode.
S: Change the delay time between two refreshes. Prompts the user to enter a new time, the default value is 5 units for S. Shouldn't be too small
F or F: Add or remove items from the current display.
O or O: Change the order in which items are displayed.
L: Toggle display of average load and start time information. That shows the first row of shadows.
M: Toggles display memory information. The shadow memory line is displayed
T: Toggles display of process and CPU status information. The shadow CPU line is displayed
W: Writes the current settings to the ~/.TOPRC file. This is the recommended way to write top configuration files
*1. The first line is the task queue information
Results of execution with uptime command:
# uptime
13:22:30 up 8 min, 4 users, Load average:0.14, 0.38, 0.25
The contents are as follows:
12:38:33 Current time
Up 50days system run time, format last: minutes
1 user Current number of users logged on
Load average:0.06, 0.60, 0.48
System load, which is the average length of the task queue. The three values were 1 minutes, 5 minutes, and 15 minutes ago to the present average.
It's best to stay below 0.7.
*2. Second to third behavioral process and CPU information
When there are multiple CPUs, the content may be more than two lines. The contents are as follows:
tasks:29 Total Process Totals
1 running number of running processes
Sleeping The number of sleep processes
0 number of processes stopped stopped
0 Zombie number of zombie processes
CPU (s): 0.3% US user space consumes CPU percentage
1.0% sy core space CPU percent occupied
0.0% CPU Percentage of processes that have changed priority within NI user process space
98.7% ID Idle CPU percent
0.0% wa wait for the input output CPU time percentage
0.0% hi
0.0% si
*3. Four or five Behavior memory information:
Same as free first line
KiB mem:1001360 Total, 699724 free,138140 used,163496 Buff/cache
Total memory size, available, used, disk cache size:
* Process information:
Column name: Meaning:
PID Process ID
PPID Parent Process ID
Ruser Real user name
User ID of the UID process owner
Username of user Process Owner
Group Process Owner's name
The terminal name of the TTY startup process. Processes that are not started from the terminal are displayed as?
PR -Priority
NI Nice value. Negative values indicate high priority, positive values indicate low priority
P Last used CPU, only meaningful in multi-CPU environment
%cpu Percentage of CPU time that was last updated to current
The total CPU time, in seconds, used by the duration process
Total CPU time used by the time+ process, Unit 1/100 sec
Percentage of physical memory used by the%MEM process
The total amount of virtual memory used by the VIRT process, in kilobytes. Virt=swap+res
The swap process uses the amount of virtual memory that is swapped out, in kilobytes.
The size, in kilobytes, of the physical memory used by the RES process and not swapped out. Res=code+data
The amount of physical memory the code executable consumes, in kilobytes per kb
The amount of physical memory that is used outside the data executable code (segment + stack), in kilobytes
SHR Shared memory size, in kilobytes
Nflt number of page faults
NDRT the number of pages that were modified the last time it was written to.
S Process State
d= non-disruptive sleep state
R= Run
S= Sleep
t= Tracking/Stopping
z= Zombie Process
command name/command line
Wchan If the process is sleeping, the system function name in sleep is displayed
Flags Task flag, reference sched.h
Only the more important are shown by default:
PID, USER, PR, NI, VIRT, RES, SHR, S,%cpu,%MEM, time+, COMMAND columns.
1) F Key To change the display content can be selected to display content.
Press the F key to display a list of columns, press A-Z to show or hide the corresponding column, enter OK.
2) Press the O key to change the order in which the columns are displayed.
A-Z in the lower case moves the corresponding column to the right, while the uppercase A-Z moves the corresponding column to the left. Enter key to confirm.
Press the uppercase F or O key, and then press A-Z to sort the process by the appropriate column. The uppercase R key can reverse the current sort.
This article is from the "mediocre" blog, please be sure to keep this source http://zzjasper.blog.51cto.com/9781564/1833702
Top command usage and interpretation