一、简介:
iotop:一款类似top的I/O监控工具,只显示正在产生I/O的进程或线程。
iotop监控的主要项:
- 进程/线程的I/O的读写带宽
- 进程/线程swapin的耗时占比
- 进程/线程的I/O阻塞(等待)耗时占比
- 每个进程/线程的I/O优先级
- 系统中I/O总读写带宽
- 系统中I/O实际读写带宽(和总读写带宽有时候值并不一致)
二、安装
yum安装
Centos
sudo yum install -y iotop
输入:iotop -h
Usage: /usr/sbin/iotop [OPTIONS]
DISK READ and DISK WRITE are the block I/O bandwidth used during the sampling
period. SWAPIN and IO are the percentages of time the thread spent respectively
which the thread is running (set using the ionice command).
DISK READ:采样周期内读磁盘的带宽(平均值)
DISK WRITE:采用周期内写磁盘的带宽(平均值)
SWAPIN:磁盘换入的时间占总时间的百分比(内存不够用的时候会进行内存换入到磁盘)
IO: 普通的磁盘读写等待时间占总时间的百分比
PRIO: 进程/线程进行I/O调度时候的优先级(使用ionice设定)
Controls: left and right arrows to change the sorting column, r to invert the
sorting order, o to toggle the –only option, p to toggle the –processes
option, a to toggle the –accumulated option, i to change I/O priority, q to
quit, any other key to force a refresh.
按键控制:
⬅️/➡️:选择排序的列
r:按逆序排列当前IO进程/线程列表
o:同–only参数
p: 同–processes参数
a: 同–accumulated参数
i: 改变I/O优先级
q: 退出iotop
其他任意键:强制刷新当前IO进程/线程列表
Options:
–version show program’s version number and exit //显示版本信息
-h, –help show this help message and exit //显示帮助信息
-o, –only only show processes or threads actually doing I/O //显示当前有I/O活动的进程或者线程(也就是没有进行IO操作的进程/线程不展示到列表)
-b, –batch non-interactive mode //非交互模式,即后台模式(这个可以把信息重定位输出到某个文件)
-n NUM, –iter=NUM number of iterations before ending [infinite] //信息刷新次数,默认一直刷新,不会自行退出;如果指定该参数为N,则iotop在更新N次列表信息后自动退出(此参数在批处理模式下比较方便)
-d SEC, –delay=SEC delay between iterations [1 second] //信息刷新间隔,即每隔几秒刷新一次,默认为每隔一秒刷新一次
-p PID, –pid=PID processes/threads to monitor [all] //筛选展示特定PID的进程或者线程,默认为所有进程/线程
-u USER, –user=USER users to monitor [all] //筛选展示特定用户下进程/线程IO,默认为所有用户
-P, –processes only show processes, not all threads //筛选只展示进程的IO信息,默认展示所有进程和线程的IO信息
-k, –kilobytes use kilobytes instead of a human friendly unit //设置IO的单位为KB/s,默认根据IO大小自行进行单位适配。(在批处理模式下设置比较方便统计)
-t, –time add a timestamp on each line (implies –batch) //批处理模式,在每行前面加上时间戳
-q, –quiet suppress some lines of header (implies –batch) //批处理模式,只在打印一次列名
-qq column names are never printed, //不打印列名
-qqq the I/O summary is never printed. //连概要信息也不打印
四、例子
1.每隔十秒打印一次信息,仅打印有活跃I/O的进程和线程数据
iotop -d 10 -o
2.每隔十秒打印一次信息,设置单位为KB/s,仅打印有活跃I/O的进程和线程数据
iotop -d 10 -o -k
如果您觉得阅读本文对您有帮助,请点一下"推荐"按钮,您的"推荐"将是我最大的写作动力!
Original: https://www.cnblogs.com/sky-heaven/p/16423312.html
Author: sky-heaven
Title: iotop【转】
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/546160/
转载文章受原作者版权保护。转载请注明原作者出处!