strace -tt -o a.strace hdparm -t /dev/sda
/dev/sda:
Timing buffered disk reads: 76 MB in 3.01 seconds = 25.26 MB/sec
查看a.strace 观察hdparm的测试原理
open("/dev/sda", O_RDONLY|O_NONBLOCK) = 3
nanosleep({3, 0}, {3, 0}) = 0
15:30:01.048912 read(3, "\353H\220\0\216\320\274\0|\373\216\330\374\271\200\0\213"…, 2097152) = 2097152
15:30:01.097253 getitimer(ITIMER_REAL, {it_interval={1000, 976}, it_value={999, 951984}}) = 0
…
打开要测试的设备,每次读取2M的数据,测试3秒钟,最后读取的数据总量除以3秒,得出平均每秒读取的数据量
本次测试每秒25MB的速度,是比较慢的,一般的磁盘也要80MB/s
strace -tt -o a.strace hdparm -T /dev/sda
/dev/sda:
Timing cached reads: 3112 MB in 1.91 seconds = 1632.99 MB/sec
先读取一大批数据,然是使用下面的调用来测试:
15:42:40.729945 lseek(3, 0, SEEK_SET) = 0
15:42:40.730000 getitimer(ITIMER_REAL, {it_interval={1000, 976}, it_value={996, 835457}}) = 0
15:42:40.730066 lseek(3, 0, SEEK_SET) = 0
15:42:40.730121 getitimer(ITIMER_REAL, {it_interval={1000, 976}, it_value={996, 835457}}) = 0
15:42:40.730186 lseek(3, 0, SEEK_SET) = 0
好像是测试的磁盘的寻道,但是为什么总是定位在开始,不明白????