Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Linux CPU Monitoring Index     - Analysis examples: Intrusion Response Linux platform Case (Linux)

- Ubuntu 15.04 using the Eclipse 4.4, Java 8 and WTP (Linux)

- rpm package specify the installation path (Linux)

- Hibernate learning introductory tutorial (Programming)

- Ubuntu / Fedora / CentOS system how to install Plex Media Server 0.9.9 (Linux)

- Using the Linux folder wc statistics number of lines of code for all files (including subdirectories) (Linux)

- How to turn Java String into Date (Programming)

- Use Ansible efficient delivery Docker container (Server)

- Python when automated operation and maintenance often used method (Programming)

- Docker improve safety (Server)

- Automatic and Manual Proxy Settings Switch GNOME Shell Extension Proxy Switcher Recommend (Linux)

- Oracle database online redo logs are several methods of recovery of deleted (Database)

- Linux installed and tested the deployment of Kafka distributed cluster (Server)

- Zabbix Agent for Linux Installation and Configuration (Server)

- Open log in Hibernate (Programming)

- Install Ubuntu 14.04 and Windows 8 / 8.1 dual-boot in UEFI mode (Linux)

- Installation Mate Desktop in FreeBSD 10.1 (Linux)

- Use XtraBackup be physical standby database MySQL (Database)

- Oracle multi-table query optimization (Database)

- Android Studio Getting Started Hello World (Programming)

 
         
  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.
     
         
         
         
  More:      
 
- C ++ 11 feature: auto keyword (Programming)
- The temporary operation of the document mkstemp on Linux (Linux)
- Java rewrite equals method (Programming)
- Talk about Java EE Learning (Programming)
- Use LKM change the default linux security level (Linux)
- CentOS 6.5 platform offline compile and install PHP5.6.6 (Server)
- How to install and configure the KVM and Open vSwitch on Linux distributions (Linux)
- Linux automatically install service components and optimize the kernel parameters (Linux)
- vector C ++ sequence containers (Programming)
- The difference between vi and nano (Linux)
- Do not enter password login ssh (Server)
- Install Firefox 32 official version of the Linux system (Linux)
- Ubuntu 14.04 virtual machine switching desktop environments (Linux)
- CentOS RedHat YUM Source Extensions Supplement (including 32-bit, 64-bit) (Linux)
- SUSE Linux network configuration and firewall configuration (Linux)
- How to configure HTTP Strict Transport Security (HSTS) (Linux)
- RCU lock in the evolution of the Linux kernel (Linux)
- ActiveMQ memory settings and flow control (Linux)
- PostgreSQL 9.3.5 database installation under Ubuntu Server 14.04 (Database)
- Linux top command to get started (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.