System performance monitoring Tool-top

Source: Internet
Author: User

Real-time display of resource usage for each process in the system, similar to the Task Manager for Windows

[email protected] ~]# top [-d] | Top [-BNP]
Parameters:
-D: The number of seconds after which the entire program screen is updated. The preset is 5 seconds;
-B: Perform the top in batch mode
Typically, data flow redirection is used to export the results of a batch to an archive.
-N: Paired with-B, the meaning is to make several top output results.
-P: Specify some PID for observation and monitoring

key commands that can be used during top execution:
?: Displays the key commands that can be entered in the top;
P: The use of CPU resources to sort the display;
M: The use of memory to sort the display of resources;
N: Sort by pid!
T: The CPU Time accumulation (time+) used by the process is sorted.
K: give some PID a signal (signal)
R: Give some PID a nice value to re-establish.

F: Enter the display edit mode and the ESC key exits the mode.

H: Help information, such as:

Example one: Update top every two seconds to see overall information:
[Email protected] ~]# top-d 2

Example two: 2 times the top information and then output the result to/tmp/top.txt
[[email protected] ~]# top-b-N 2 >/tmp/top.txt

Example three: Assume that 10604 is an existing PID and only observe the program
[Email protected] ~]# top-d 2-p10604

Example four: a situation where only one thread is displayed separately

1, [[email protected] ~]# top-d 2-p10604

2, in the key: H

Example five: The above question, the NI value above is 0, want to change to 10? When you press R directly in the top screen of example three, the following pattern appears:

top-13:53:00 up, 2:27, 1 user, load average:0.00,0.00, 0.00
Tasks:1 Total, 0 running, 1 sleeping, 0 stopped, 0 zombie
Cpu (s): 0.0% us, 0.0% sy, 0.0% ni, 100.0% ID, 0.0% wa, 0.0% Hi, 0.0% si
mem:385676k Total, 371760k used, 13916k free, 131164k buffers
swap:1020116k Total, 880k used, 1019236k free, 95772k cached
PID to renice:10604
PID USER PR NI VIRT RES SHR S%cpu%MEM time+ COMMAND
10604 Root 0 5396 1544 1244 S 0.0 0.4 0:00.07 Bash
after that, you can enter a nice value!
top-13:53:00 up, 2:27, 1 user, load average:0.00,0.00, 0.00
Tasks:1 Total, 0 running, 1 sleeping, 0 stopped, 0 zombie
Cpu (s): 0.0% us, 0.0% sy, 0.0% ni, 100.0% ID, 0.0% wa, 0.0% Hi, 0.0% si
mem:385676k Total, 371760k used, 13916k free, 131164k buffers
swap:1020116k Total, 880k used, 1019236k free, 95772k cached
Renice PID 10604 to Value:10
PID USER PR NI VIRT RES SHR S%cpu%MEM time+ COMMAND
10604 root 5396 1544 1244 S 0.0 0.4 0:00.07 Bash

Top output parsing:

Top is mainly divided into two pictures, the above screen for the entire system of resource use state, basically a total of six lines, the content of the display is:
First line: displays the time the system was started, the current number of people on the line, and the overall system load (load). The comparison needs to be noted for the load of the system, three data representing the average load of 1, 5, 10 minutes respectively. In general, this load value should be less than the number of CPUs *cpu the number of cores *0.7

The second line: shows the current number of observers, the comparison should be noted that the last zombie that value, if not 0, take a good look at the end of the process into the body of the
Line Three: The overall CPU load is displayed, and each item can be consulted. Need to observe the value of the ID (idle), generally speaking, he should be close to 100%, indicating that the system is rarely used resources


Lines Fourth and fifth: represents the current use of physical memory and virtual memory (MEM/SWAP).


after line sixth: This is where the state is displayed when the command is entered in the top program. The picture below the top is the resource situation used by each process.

By default, only the more important PID, USER, PR, NI, VIRT, RES, SHR, S,%cpu,%MEM, time+, and COMMAND columns are displayed. You can change the display by using the following shortcut keys.
To change what is displayed:
1) Use the F key to select the displayed content. Press the F key to display a list of columns, press A-Z to show or hide the corresponding column, and then press ENTER to confirm.
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. Finally, press ENTER to confirm.
3) 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.

System performance monitoring Tool-top

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.