linux – 在ubuntu中输出/ proc / diskstats
发布时间:2020-12-14 02:44:05 所属栏目:Linux 来源:网络整理
导读:谁能告诉我关于/ proc / diskstats中的第11个字段? 文档说它是加权执行I / O所花费的毫秒数.它是否像在一秒钟内为DiskIO花费的毫秒数? 我从减去前一个值后每200ms记录一次该值,并观察到该值高达7000.我需要绘制一个显示磁盘IO速率的图表.这是脚本: #!/bin
谁能告诉我关于/ proc / diskstats中的第11个字段?
文档说它是加权执行I / O所花费的毫秒数.它是否像在一秒钟内为DiskIO花费的毫秒数? 我从减去前一个值后每200ms记录一次该值,并观察到该值高达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 任何人都可以解释这个领域吗? 解决方法
从
documentation:
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. 该字段的增量除了执行IO所花费的时间乘以正在进行的IO请求的数量,因此它的时间由活动请求的数量加权.它考虑了IO队列的大小. 例如,一台机器在最后一秒内不断地执行IO,但是队列永远不会超过1个请求的值为1000.一台机器也会在最后一秒内不断地执行IO,但平均队列长度为10个请求会有价值10 000. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |