Its pretty simple. I open /dev/hda (the whole device), and read random
blocks, timing how long it takes for the data to come back since the
last one. I set up a few hundred/thousand buckets, and accumulate the
measured time into the bucket for that seek distance. So:
fd=open("/dev/hda")
llseek(fd, last = rand());
read(fd)
while(!finished) {
blk = rand();
llseek(fd, blk);
read(fd);
bucket[abs(last-blk)] = time;
last = blk;
}
I found the random seeking was the only way I could get reasonable
numbers out of the drive; any of the ordered patterns of the form "OK,
lets measure N block seeks" seemed to be predicted by the drive and gave
unreasonably fast results.
This technique measures seek+rotational latency for reads.
Seek-for-reading is generally faster than seek-for-writing, because they
start reading as soon as the head is appoximately in the right place,
and start using the data as soon as the ECCs start checking out OK. You
certainly can't start writing until you've done the full head-settle
time (another 1-2ms).
I'll see what state my measurement code is in (technically and legally)
and see if I can release it. Anyway I'm happy to answer questions.
J
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/