Gau*_*rav 3 linux ubuntu bash hard-drive
谁能告诉我 /proc/diskstats 中的第 11 个字段吗?文档说它是对 I/O 花费的毫秒数进行加权。是不是像一秒钟内 DiskIO 花费的毫秒数?
我每 200 毫秒记录一次该值,并从中减去前一个值,观察到该值高达 7000。我需要绘制一张显示磁盘 IO 速率的图表。这是脚本:
#!/bin/bash
PREV_TOTAL=0
echo "" >> $1
while true; do
numbers=( $(tail -3 < /proc/diskstats | head -2 | awk '{print $14}' ) ) ;
let "TOTAL=$((${numbers[0]} + ${numbers[1]}))"
let "DIFF_TOTAL=$TOTAL-$PREV_TOTAL"
time=`date +%s%N`
echo "$time $DIFF_TOTAL" >> $1
PREV_TOTAL="$TOTAL"
# Wait before checking again.
sleep 0.2
done
Run Code Online (Sandbox Code Playgroud)
有人能解释一下这个领域吗?
从文档中:
Field 11 -- weighted # of milliseconds spent doing I/Os
This field is incremented at each I/O start, I/O completion, I/O
merge, or read of these stats by the number of I/Os in progress
(field 9) times the number of milliseconds spent doing I/O since the
last update of this field. This can provide an easy measure of both
I/O completion time and the backlog that may be accumulating.
Run Code Online (Sandbox Code Playgroud)
该字段的增量是执行 IO 所花费的时间乘以正在进行的 IO 请求数,因此它是按活动请求数进行时间加权的。它考虑了 IO 队列的大小。
例如,一台机器在最后一秒不断执行 IO,但队列永远不会大于 1 个请求,其值为 1000。一台机器在最后一秒不断执行 IO,但平均队列长度为 10 个请求,则其值为 1000。值为 10 000。
| 归档时间: |
|
| 查看次数: |
4726 次 |
| 最近记录: |