- Learning Linux Shell Scripting
- Ganesh Naik
- 536字
- 2021-06-25 22:02:48
Process monitoring tools – top, iostat, and vmstat
We can view the native performance of various processes in an OS by using the following tools:
- To view a dynamic real-time view of the running processes in an OS, use the following command:
$ top
An explanation of the top command generated output is as follows:
The $top command displays a lot of information about the running system.
The first line of the display is shown as follows:
The description of fields in the first line is as follows:
- Current time
- System uptime
- Number of users logged in
- Load average of 5, 10, and 15 minutes, respectively
The second line is shown as follows:
This line shows the summary of tasks or processes. It shows the total number of all the processes, which includes the total number of running, sleeping, stopped, and zombie processes. The third line is shown as follows:
This line shows information about CPU usage as a % in different modes as follows:
- * us (user): CPU usage in % for running (un-niced) user processes
- * sy (system): CPU usage in % for running kernel processes
- * ni (niced): CPU usage in % for running niced user processes
- * wa (IO wait): CPU usage in % waiting for IO completion
- * hi (hardware interrupts): CPU usage in % for serving hardware interrupts
- * si (software interrupts): CPU usage in % for serving software interrupts
- * st (time stolen): CPU usage in % for time stolen for this VM by
the hypervisor
The fourth line is shown as follows:
This line provides information about memory usage. It shows the physical memory that is used, free, available, and used for buffers. The next line shows the swap memory that is available, used, free, and cached.
After this line, we see the table of values with the following columns:
- PID: This is the ID of the process
- USER: This is the user that is the owner of the process
- PR: This is the priority of the process
- NI: This is the NICE value of the process
- VIRT: This is the virtual memory used by the process
- RES: This is the physical memory used for the process
- SHR: This is the shared memory of the process
- S: This indicates the status of the process: S = sleep, R = running, and Z = zombie (S)
- %CPU: This is the % of CPU used by this process
- %MEM: This is the % of RAM used by the process
- TIME+: This is the total time of activity of this process
- COMMAND: This is the name of the process
Let's take a look at the performance monitoring tools iostat, vmstat, and sar:
- To view the statistics of the CPU and the input/output device's utilization, use the following command:
$ iostat
$ iostat -c
- Shows only CPU statistics
$ iostat -d
- Shows only disk statistics
- To view the virtual memory statistics, use the following command:
$vmstat
$ vmstat -s
- This shows various event counters and memory statistics
$ vmstat -t 1 5
- Runs for every one second stop after executing for five intervals
$ sar -u 2 3
- This will show the CPU activity report three times every 2 seconds:
- PPT,要你好看
- 自動控制工程設(shè)計(jì)入門
- Seven NoSQL Databases in a Week
- 樂高機(jī)器人EV3設(shè)計(jì)指南:創(chuàng)造者的搭建邏輯
- 商戰(zhàn)數(shù)據(jù)挖掘:你需要了解的數(shù)據(jù)科學(xué)與分析思維
- 機(jī)器學(xué)習(xí)與大數(shù)據(jù)技術(shù)
- 樂高創(chuàng)意機(jī)器人教程(中級 下冊 10~16歲) (青少年iCAN+創(chuàng)新創(chuàng)意實(shí)踐指導(dǎo)叢書)
- 機(jī)器人創(chuàng)新實(shí)訓(xùn)教程
- 計(jì)算機(jī)系統(tǒng)結(jié)構(gòu)
- AutoCAD 2012中文版繪圖設(shè)計(jì)高手速成
- Google SketchUp for Game Design:Beginner's Guide
- 西門子變頻器技術(shù)入門及實(shí)踐
- 菜鳥起飛系統(tǒng)安裝與重裝
- 工業(yè)機(jī)器人維護(hù)與保養(yǎng)
- 激光選區(qū)熔化3D打印技術(shù)