3

can anybody tell me about 11th field in /proc/diskstats? The documentation says that it is weighted # of milliseconds spent doing I/Os. Is it like # of milliseconds spent for DiskIO in a second?

I logged this value every 200ms after subtracting previous one from it and observed the value as high as 7000. I need to plot a graph showing disk IO rate. Here is the script:

#!/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

Can anybody explain this field?

4

From the 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.

The field is incremented by the time spent doing IO multiplied by the number of IO requests in progress, so it's time weighted by number of active requests. It takes the size of the IO queue into account.

For example, a machine constantly doing IO over the last second, but the queue never larger than 1 request would have a value of 1000. A machine also constantly doing IO over the last second, but with an average queue length of 10 requests would have a value of 10 000.

2

from: http://www.mjmwired.net/kernel/Documentation/iostats.txt

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.
2
  • does it mean like if the last update was made 10 seconds ago, then the new value is number of milliseconds spent in diskIO out of 10,000 milliseconds, right?
    – Gaurav
    Feb 7 '13 at 18:14
  • I am really not sure, but i think the amount are: the number of I/Os in progress (field 9) * number of milliseconds spent doing I/O since the last update of this field.
    – Brigo
    Feb 7 '13 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.