Monday, March 29, 2010

Disk reading performance with hdparm

hdparm can be used to get disk reading performance with following command line:

  • hdparm -T <dev>. Get cached disk reading performance. In fact, the page cache performance is tested.
  • hdparm -t <dev>. Get raw disk reading performance.

Implementation

hdparm -T
ioctl(devfd, BLKFLSBUF, NULL);
read(devfd, buf, READING_SIZE)
do {
seek(devfd, 0, SEEK_SET);
read(devfd, buf, READING_SIZE);
} while (/* time is not over */);

Because the data to be read is in page cache always (if READING_SIZE << memory size), the result is page cache performance.

hdparm -t
ioctl(devfd, BLKFLSBUF, NULL);
do {
read(devfd, buf, READING_SIZE);
} while (/* time is not over */);

Because the data to be read is not in page cache, and the bottleneck lies in raw disk reading speed, the result is raw disk reading performance.

reading prepare *         *         *
memory copy - -
raw disk read ++++++++ ++++++++

As in above figure, reading reparation and memory copying in testing is neglectable, especially when readahead is considered.

2 comments:

モバゲー said...

モバゲータウンでは今までとは一味違う出逢いを体験する事ができるのです。これまで良い出逢いがなかった人にはもってこいの無料登録型の掲示板です

出会い said...

エロセレブとの出会いを完全無料でご提供します。逆援助で高額報酬をゲットしよう