我正在运行一些使用cpu、磁盘和网络资源的实验。(顺便说一句,我使用的是分区OS 7),我想测量它的cpu、磁盘和网络资源的使用情况。
我知道的一些工具(dstat,iostat)只提供一秒钟作为两个度量之间的最小间隔。
我怎么能在一秒钟内进行几次测量?我在谷歌上搜索了很多,但找不到。
谢谢
发布于 2017-07-02 04:10:03
希望有人能给你指点一些工具来做你想做的事情,但是如果你没有做到这一点,那么你就可以直接从源获取数据。iostat主要是解析像/proc/diskstats这样的特殊文件,当您读取这些文件时,这些文件就会被更新。我刚刚做了一个快速测试,我读了很多次磁盘数据,每次读取时,值都会发生变化。
iostat手册页面最后列出了相关的文件:
/proc/stat包含系统统计信息。/proc/uptime包含系统正常运行时间。/proc/分区包含磁盘统计信息(用于已修补的2.5前内核)。/proc/diskstats包含磁盘统计数据(用于post 2.5内核)。/sys包含块设备的统计信息(post 2.5内核)。/proc/self/mountstats包含网络文件系统的统计信息。/dev/disk包含持久的设备名称。
不难找到这些文件中的字段所代表的信息。例如:
The /proc/diskstats file displays the I/O statistics
of block devices. Each line contains the following 14
fields:
1 - major number
2 - minor mumber
3 - device name
4 - reads completed successfully
5 - reads merged
6 - sectors read
7 - time spent reading (ms)
8 - writes completed
9 - writes merged
10 - sectors written
11 - time spent writing (ms)
12 - I/Os currently in progress
13 - time spent doing I/Os (ms)
14 - weighted time spent doing I/Os (ms)
For more details refer to Documentation/iostats.txthttps://unix.stackexchange.com/questions/374633
复制相似问题