- Learning Linux Shell Scripting
- Ganesh Sanjiv Naik
- 537字
- 2021-08-20 10:44:30
Process monitoring tools – top, iostat, and vmstat
We can view the native performance of various processes in OS using tools which will be discussed further. To view a dynamic real-time view of the top running processes in 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 in % in different modes as follows:
- * us (user): CPU usage in % for running (un-niced) the user processes
- * sy (system): CPU usage in % for running the kernel processes
- * ni (niced): CPU usage in % for running the niced user processes
- * wa (IO wait): CPU usage in % for waiting for the 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 processUSER
: This is the user that is the owner of the processPR
: This is the priority of the processNI
: This is the "NICE" value of the processVIRT
: This is the virtual memory used by the processRES
: This is the physical memory used for the processSHR
: This is the shared memory of the processS
: 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 processTIME+
: This is the total time of activity of this processCOMMAND
: 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 stops after executing for five intervals.
$ sar –u 2 3
This will show the CPU activity report every 2 seconds, 3 times:
- Vue.js設計與實現(xiàn)
- 流量的秘密:Google Analytics網(wǎng)站分析與優(yōu)化技巧(第2版)
- 前端跨界開發(fā)指南:JavaScript工具庫原理解析與實戰(zhàn)
- 軟件界面交互設計基礎
- Learning Data Mining with Python
- 前端架構:從入門到微前端
- Visual Basic程序設計習題解答與上機指導
- Mobile Device Exploitation Cookbook
- Scratch3.0趣味編程動手玩:比賽訓練營
- HTML+CSS+JavaScript網(wǎng)頁制作:從入門到精通(第4版)
- Django Design Patterns and Best Practices
- Keil Cx51 V7.0單片機高級語言編程與μVision2應用實踐
- Learning Ext JS(Fourth Edition)
- 區(qū)塊鏈原理、架構與應用(第2版)
- VB語言程序設計教程(第2版)