Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Linux CPU Monitoring Index     - Precautions against hackers Linux environment (Linux)

- Oracle database physical file backup / restore (Database)

- MongoDB fragmentation (Cluster) (Database)

- Java threads and thread pools (Programming)

- Xtrabackup creates a slave node without downtime (Database)

- STL in the list of erase () method (Programming)

- 64-bit Ubuntu 15.10 How to compile the latest version of the 32 Wine 1.7.53 (Linux)

- How to turn Java String into Date (Programming)

- Linux directory configuration (Linux)

- Ubuntu install snmp packets Unlinked OID in IPATM-IPMC-MIB: marsMIB (Linux)

- Achieve camera preview by ffplay (Linux)

- CentOS achieve trash mechanism (Linux)

- Ubuntu 14.04 / 14.10 how to install Mate 1.10.0 (Linux)

- Storm basic framework for analysis (Programming)

- Learning how to teach safety system to prevent your own IP leakage (Linux)

- C # DateTime structure common method (Programming)

- MySQL full-index scan bug (Database)

- Ubuntu user use PPA to install Uget 2.0.5 (Linux)

- Nginx + Tomcat static and dynamic load balancing and separation configuration essentials under Linux (Server)

- Red Hat Enterprise Linux configuration VNC multi-user access methods (Linux)

  Linux CPU Monitoring Index
  Add Date : 2017-08-31      
  Linux provides a very rich command can monitor the data related to the CPU, for example: top, vmstat commands. top is a dynamic display of process, that can be constantly refreshed by the user key to the current state. If you perform tasks in the foreground of the command, it will monopolize the front desk until the user terminates the program far more accurate to say, top command provides a real-time status monitoring system processor, it will show the system CPU the most "sensitive" list. This command can be CPU usage, memory usage and execution time to sort tasks; and many of the features of the order can be set in a personal or custom files through an interactive command.

    top command provides the following parameters:
    top [-] [d delay] [p pid] [q] [c] [C] [S] [s] [i] [n iter] [b]
Option Name Description
Time interval (delay interval value that is specific, it is in seconds) d delay specified for each screen information twice between refreshes, you can use the s interactive command to change it.
p pid by specifying the monitoring process ID (pid) to only monitor the status of a process.
q This option will allow top to refresh without any delay. If the caller has superuser privileges, then the top priority will be run as high as possible.
c show the entire command line rather than just display the command name.
C display total CPU information are displayed for each CPU replace information, this parameter is valid only for SMP systems.
S Specifies cumulative mode.
s so top command to run in safe mode. This will remove the potential dangers posed by interactive commands.
i so top does not show any idle or zombie processes.
n iter iterations specified number of top command output, iter iterations concrete value.
b "Batch" run top, in this mode, all input from the terminal will be ignored (except, of course ctrl + c), this parameter can be combined with the parameter "n" to run a specified number of iterations or exit the process is killed . This is the top run output to a dumb terminal or output to a non-default operating mode of the terminal
Example One
In the console input "top", Enter the following:

top command output consists of two parts:
The first part of the statistical information, including the five elements of data; the second part is the detailed information that shows the details of each process.

It is necessary to understand the content of the information under the statistical output portion meanings:
Output instructions
19:47:24 Current time
up 15 min run time system
2 users currently logged on the number of users, and here is the root jzhou
load average: 0.02, 0.14, 0.21 system load, that is, the average length of the task queue. Three values were 1 minute, 5 minutes, 15 minutes ago now mean to that 0.02,0.14,0.21
Tasks: 122 total, 1 running, 120 sleeping, 0 stopped, 1 zombie 122 processes (tasks), which has two in operation, 120 in a sleep state, did not stop the process, there is a zombie
Cpus: 0.7% us, 0.7% sy, 0.0% ni, 97.6% id, 0.0% wa, 0.7% hi, 0.3% si, 0.0% st Cpu running, the user process (user) CPU-0.7%, the system processes (system) CPU-0.7%, user processes have not changed the process priority, so user nice value of 0.0%, 97.6% of the CPU is idle (idle), without waiting for input and output, the value is also iowait 0.0%, the terminal hardware request time (hardware interrupt) accounted for 0.7% CPU, the soft terminal requests accounted for 0.3% CPU time of, st representatives steal time, the specific role is not very clear, said the Internet is reserved for the other CPU is not clear
Mem: 1035244k total, 537528k used, 497716k free, 25816k buffers total memory 1035244k, the total amount of memory used for 537528k, 497716k idle amount of memory, the total used memory 25816k kernel cache. (This is the case of virtual machines, physical machines as if there are other parameters)
Swap: 0k total, 0k used, 0k free, 351392k cached for the total amount of swap 0k, the total amount of swap partition is 0k, the total amount of free swap partition 0k, 351392k the total amount of buffer exchange zone (cached), memory the content is the affected area to swap, but later was changed into memory, but the used swap has not been covered, the value is the size of the content already exists in memory swap area. Corresponding memory again can no longer be written to swap when swapped out. Then take a look at the content information output section details:
Output instructions
PID process identifier
USER process owner user name
Priority PR / PRI process execution
NI NICE value, a negative value indicates a high priority, a positive value indicates a low priority
VIRT total virtual memory used by the process, the unit kb. VIRT = SWAP + RES
RES process uses, not swapped out of physical memory size, unit kb. RES = CODE + DATA
SHR shared memory size, unit kb
S / STAT process state
D: uninterruptible sleep state
R: running, or processes in the queue
S: dormant
T: Stop or Tracking
Z: zombie process
W: enter memory swapping
X: process dead

% CPU last update to the current occupancy percentage of CPU time
% MEN percentage of physical memory used by the process
TIME + process uses the CPU time, total, unit 1 / 100s
COMMAND command name of the process to be executed
Example Two
vmstat command allows you to see the system memory, CPU usage, etc. on the same line, usually you can use this command to view the CPU utilization and saturation.
Connect the two concepts:
CPU utilization: CPU utilization vmstat can be used by id or subtracting from 100 the sum of us and sy to calculate CPU utilization
CPU Saturation: CPU saturation by vmstat command "procs: r" as a measure of the standard, because it is the total value of all cpu run queue, it will procs: r divided by the number of CPU may be obtained with other servers Compared.
Any sustained non-zero value will cause performance degradation, but the performance degradation is gradual.
vmstat command parameters are as follows:
vmstat [-n] [delay [count]]
It is necessary to understand the meaning of the parameters under vmstat command:
Parameter Name Description
n Through this switch, if it is enabled only displayed once the header information
Specifies the delay time between refreshes every two screen information interval, unit: s
In conjunction delay count parameters when used to specify if the value, the specified number of times to run exit, otherwise it will run unlimited
In the console input "vmstat -n 1", carriage return after the execution, the command is header information appears only once every 1 second to display a vmstat monitoring information

Then learn Output information content of each section mean:

Example Three
    You can also "uptime" command to get the CPU load average. Calculate the average load is usually described as the average number of threads can run and run. For example, there is a running thread occupy CPU if a single CPU server, there are three processes running the scheduler queue, the average load is 1 + 3 = 4. For a 16CPU server load is 16 running thread, there are 24 processes running scheduler queue, load average is 40. If the average load is always higher than the number of CPU, it may cause application performance degradation. It should be noted that the average load is only applicable to the initial estimate of CPU load, in-depth analysis, we also need the help of other tools do. And then the CPU load average to have a preliminary understanding of the future, let us see how the command is used, its output also contains those elements.
Because "uptime" command provides only an optional parameter entry "V", namely: Displays the version of this command, so do not describe.
In the console input "uptime", carriage return after the implementation of the results:

You can see the "load average: 0.53,0.65,0.34" system is the CPU load average correspond to the first 1 minute, 5 minutes and 15 minutes of average load value. At the same time they also represent CPU utilization and saturation. If the value of the number of CPU load average and equal typically represents 100% CPU utilization, less than the number of CPU, then the utilization of less than 100%, greater than the number of CPU needed to measure saturation.
- To explore the caching mechanism for Android ListView (Programming)
- Node.js v4.0.0 installation configuration on Ubuntu 14.04 / 15.04 (Linux)
- C language Bubble Sort - integer sort (Programming)
- Linux Quick Install MongoDB (Database)
- Dynamic programming Android (Programming)
- Remove old kernel on Ubuntu (Linux)
- Linux system security reinforcement (Linux)
- Nginx DHCP TFTP Kickstart set up automatic installation system (Server)
- Oracle 10g, 11g database silent installation of small differences (Database)
- Windows 7 hard disk to install Ubuntu 15.04 (Linux)
- Configure shared library PCRE (Linux)
- Oracle Duplicate build DataGuard (Database)
- Linux platform to prevent hackers to share practical skills (Linux)
- How Linux system password security guarantee (Linux)
- CentOS 6.5 installation Python3.0 (Linux)
- Four levels of intrusion on Linux server and counter-measures (Linux)
- Oracle table space usage monitoring (Database)
- The mv command to move the directory two cases under Linux (Linux)
- Hadoop - Task Scheduling System Comparison (Server)
- VMware virtual machine operating system log Error in the RPC receive loop resolve (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.