I was benchmarking the synchronous read performance on a linux box with SATA disk. I timed each read call with gettimeofday(2)
and fired iostat -x
to see disk statistics when the program was running. The disk IO time shown by iostat
on the await column had an average of about 8msec, but the read time given by the program had an average of about 12msec. Where can these 4msec be spent?
Asked
Active
Viewed 165 times
1
-
Note that `gettimeofday` isn't the best way to do performance timings, it's subject to clock changes from e.g. ntpd. See http://stackoverflow.com/questions/88/is-gettimeofday-guaranteed-to-be-of-microsecond-resolution – Nicholas Knight Mar 22 '12 at 15:25
-
Do not make test posts on Stack Overflow like the one you did before. Doing so may lead to further moderator action. – casperOne Feb 08 '13 at 13:26
1 Answers
0
Copying memory, doing context switches, and running other processes.
Other processes can get sheduled and run before your read starts or after it completes, which will extend the time that your process sees.

blueshift
- 6,742
- 2
- 39
- 63
-
Thanks,As the CPU is not busy when benchmarking, what you've mentioned is not likely to cost several msecs. – Utoah Mar 23 '12 at 03:28