创建时间:2011年4月27日, 16:28:33
磁盘的读取和写入速度的测量
设备:
1. 准备
安装dd ,time在busybox中:
Coreutils --->
[*] dd
miscutils --->
[*] time
2. 命令
纯读取:
time /bin/dd if=tmp of=/dev/null bs=64k
纯写入
time /bin/dd if = /dev/zero of=tmp bs=1024 count=1000000
/******************************************************************/
/* SD卡 */
/******************************************************************/
3. 运行
A. 在开发板上
# time /bin/dd if=/dev/zero of=tmp bs=1024 count=30000
30000+0 records in
30000+0 records out
real 0m 41.35s
user 0m 0.30s
sys 0m 4.18s
# tim /bin/dd if=tmp of=/dev/null bs=64k
-/bin/sh: tim: not found
# time /bin/dd if=tmp of=/dev/null bs=64k
468+1 records in
468+1 records out
real 0m 9.79s
user 0m 0.01s
sys 0m 0.49s
#
B. 在Vmware 6.0 虚拟机上
第一次:
root@brauce-desktop:/mnt/usb# time dd if=/dev/zero of=tmp bs=1024 count=30000
30000+0 records in
30000+0 records out
30720000 bytes(31 MB) copied, 0.130739 s, 235MB/s
real 0m0.140s
user 0m0.016s
sys 0m0.104s
root@brauce-desktop:/mnt/usb# time dd if=tmp of=/dev/null bs=64k
468+1 records in
468+1 records out
30720000 bytes(31 MB) copied, 0.0316264 s, 971MB/s
real 0m0.035s
user 0m0.000s
sys 0m0.020s
第二次:
root@brauce-desktop:/mnt/usb# time dd if=/dev/zero of=tmp bs=1024 count=30000
30000+0 records in
30000+0 records out
30720000 bytes(31 MB) copied, 0.12498 s, 246MB/s
real 0m0.134s
user 0m0.012s
sys 0m0.100s
root@brauce-desktop:/mnt/usb# time dd if=tmp of=/dev/null bs=64k
468+1 records in
468+1 records out
30720000 bytes(31 MB) copied, 0.0316264 s, 971MB/s
real 0m0.035s
user 0m0.000s
sys 0m0.020s
第三次:
root@brauce-desktop:/mnt/usb# time dd if=/dev/zero of=tmp bs=1024 count=300000
300000+0 records in
300000+0 records out
30720000 bytes(307 MB) copied, 49.6879 s, 6.2MB/s
real 0m49.691s
user 0m0.072s
sys 0m1.788s
root@brauce-desktop:/mnt/usb# time dd if=tmp of=/dev/null bs=64k
4687+1 records in
4687+1 records out
307200000 bytes(307 MB) copied, 0.135681 s, 2.3GB/s
real 0m0.139s
user 0m0.004s
sys 0m0.096s
第四次:
root@brauce-desktop:/mnt/usb# time dd if=/dev/zero of=tmp bs=1024 count=300000
3000000+0 records in
3000000+0 records out
307200000 bytes(307 MB) copied, 38.6857s, 7.9MB/s
real 0m40.807s
user 0m0.096s
sys 0m1.208s
root@brauce-desktop:/mnt/usb# time dd if=tmp of=/dev/null bs=64k
4687+1 records in
4687+1 records out
307200000 bytes(307 MB) copied, 0.148741 s, 2.1GB/s
real 0m0.152s
user 0m0.004s
sys 0m0.088s
4. 分析
A. 开发板上结果分析
Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> 1024*30000
30720000
>>> 30/41.35
0.7255139056831922
>>> 30720000/9.79
3137895.8120531156
>>> 30720000/41.35
742926.2394195888
>>>
B. Vmware 6.0 虚拟机上结果分析
/******************************************************************/
/* 16GB移动U盘 */
/******************************************************************/
3. 运行
A. 在开发板上
第一次:
# time /bin/dd if=/dev/zero of=u/tmp bs=1024 count=30000
30000+0 records in
30000+0 records out
real 0m 9.38s
user 0m 0.20s
sys 0m 4.74s
# time /bin/dd if=u/tmp of=/dev/null bs=64k
468+1 records in
468+1 records out
real 0m 5.27s
user 0m 0.01s
sys 0m 0.86s
第二次:
# time /bin/dd if=/dev/zero of=u/tmp bs=1024 count=30000
30000+0 records in
30000+0 records out
real 0m 11.08s
user 0m 0.22s
sys 0m 4.83s
# time /bin/dd if=u/tmp of=/dev/null bs=64k
468+1 records in
468+1 records out
real 0m 8.23s
user 0m 0.01s
sys 0m 0.71s
第三次:
# time /bin/dd if=/dev/zero of=u/tmp bs=1024 count=30000
30000+0 records in
30000+0 records out
real 0m 13.41s
user 0m 0.23s
sys 0m 5.04s
# time /bin/dd if=u/tmp of=/dev/null bs=64k
468+1 records in
468+1 records out
real 0m 6.61s
user 0m 0.02s
sys 0m 0.95s
B. 在VMware虚拟机上
第一次:
root@brauce-desktop:/mnt/usb# time dd if=/dev/zero of=tmp bs=1024 count=300000
30000+0 records in
30000+0 records out
30720000 bytes(307 MB) copied, 33.3725s, 9.2MB/s
real 0m33.459s
user 0m0.076s
sys 0m6.564s
root@brauce-desktop:/mnt/usb# time dd if=tmp of=/dev/null bs=64k
468+1 records in
468+1 records out
30720000 bytes(307 MB) copied, 0.147436 s, 2.1GB/s
real 0m0.151s
user 0m0.000s
sys 0m0.104s
第二次:
root@brauce-desktop:/mnt/usb# time dd if=/dev/zero of=tmp bs=1024 count=300000
30000+0 records in
30000+0 records out
30720000 bytes(307 MB) copied, 33.9223s, 9.1MB/s
real 0m33.987s
user 0m0.076s
sys 0m01.316s
root@brauce-desktop:/mnt/usb# time dd if=tmp of=/dev/null bs=64k
468+1 records in
468+1 records out
30720000 bytes(307 MB) copied, 0.131432 s, 2.3GB/s
real 0m0.135s
user 0m0.004s
sys 0m0.072s
第三次:
root@brauce-desktop:/mnt/usb# time dd if=/dev/zero of=tmp bs=1024 count=300000
30000+0 records in
30000+0 records out
30720000 bytes(307 MB) copied, 35.4205s, 8.7MB/s
real 0m35.487s
user 0m0.028s
sys 0m1.516s
root@brauce-desktop:/mnt/usb# time dd if=tmp of=/dev/null bs=64k
468+1 records in
468+1 records out
30720000 bytes(307 MB) copied, 0.144891 s, 2.1GB/s
real 0m0.148s
user 0m0.000s
sys 0m0.108s
4. 分析
A. 在开发板上
第一次
Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> size=1024*30000
>>> print(size/1024/1024,'M')
29.296875 M
>>> write=size/9.38
>>> print(write/1024/1024, 'M')
3.123334221748401 M
>>> read=size/5.27
>>> print(read/1024/1024,'M')
5.559179316888046 M
第二次:
Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> size=1024*30000
>>> print(size/1024/1024,'M')
29.296875 M
>>> write=size/13.41
>>> print(write/1024/1024,'M')
2.1847035794183447 M
>>> read=size/8.23
>>> print(read/1024/1024,'M')
3.5597660996354796 M
第三次:
Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> size=1024*30000
>>> print(size/1024/1024,'M')
29.296875 M
>>> write=size/13.41
>>> print(write/1024/1024,'M')
2.1847035794183447 M
>>> read=size/6.61
>>> print(read/1024/1024,'M')
4.432204992435703 M
B. 在VMware虚拟机上
/******************************************************************/
/* 500 GB移动硬盘 */
/******************************************************************/
3. 运行
A. 在开发析上
第一次:
# time /bin/dd if=/dev/zero of=tmp bs=1024 count=30000
30000+0 records in
30000+0 records out
real 0m 7.90s
user 0m 0.21s
sys 0m 4.36s
# time /bin/dd if=tmp of=/dev/null bs=64k
468+1 records in
468+1 records out
real 0m 6.59s
user 0m 0.00s
sys 0m 1.05s
第二次:
# time /bin/dd if=/dev/zero of=tmp bs=1024 count=30000
30000+0 records in
30000+0 records out
real 0m 8.36s
user 0m 0.17s
sys 0m 4.40s
# time /bin/dd if=tmp of=/dev/null bs=64k
468+1 records in
468+1 records out
real 0m 5.37s
user 0m 0.01s
sys 0m 1.34s
第三次:
# time /bin/dd if=/dev/zero of=tmp bs=1024 count=30000
30000+0 records in
30000+0 records out
real 0m 8.42s
user 0m 0.34s
sys 0m 4.58s
# time /bin/dd if=tmp of=/dev/null bs=64k
468+1 records in
468+1 records out
real 0m 7.95s
user 0m 0.00s
sys 0m 0.70s
随机参考结果:
# time /bin/dd if=tmp of=/dev/null bs=64k
468+1 records in
468+1 records out
real 0m 7.26s
user 0m 0.01s
sys 0m 0.79s
# time /bin/dd if=tmp of=/dev/null bs=64k
468+1 records in
468+1 records out
real 0m 6.84s
user 0m 0.01s
sys 0m 1.10s
# time /bin/dd if=tmp of=/dev/null bs=64k
468+1 records in
468+1 records out
real 0m 37.94s
user 0m 0.01s
sys 0m 0.85s
B. 在Vmware虚拟机上
第一次:
root@brauce-desktop:/mnt/usb# time dd if=/dev/zero of=tmp bs=1024 count=30000
30000+0 records in
30000+0 records out
30720000 bytes(31 MB) copied, 0.291994 s, 105MB/s
real 0m0.292s
user 0m0.004s
sys 0m0.272s
root@brauce-desktop:/mnt/usb# time dd if=tmp of=/dev/null bs=64k
468+1 records in
468+1 records out
30720000 bytes(31 MB) copied, 0.0316264 s, 971MB/s
real 0m0.035s
user 0m0.000s
sys 0m0.020s
第二次:
root@brauce-desktop:/mnt/usb# time dd if=/dev/zero of=tmp bs=1024 count=30000
30000+0 records in
30000+0 records out
30720000 bytes(31 MB) copied, 0.137522 s, 223MB/s
real 0m0.146s
user 0m0.000s
sys 0m0.120s
root@brauce-desktop:/mnt/usb# time dd if=tmp of=/dev/null bs=64k
468+1 records in
468+1 records out
30720000 bytes(31 MB) copied, 0.032123 s, 956MB/s
real 0m0.035s
user 0m0.000s
sys 0m0.020s
以下为大容量测试(307M数据):
第三次:
root@brauce-desktop:/mnt/usb# time dd if=/dev/zero of=tmp bs=1024 count=300000
300000+0 records in
300000+0 records out
307200000 bytes(307 MB) copied, 16.6353 s, 18.5 MB/s
real 0m16.639s
user 0m0.032s
sys 0m2.816s
root@brauce-desktop:/mnt/usb# time dd if=tmp of=/dev/null bs=64k
4687+1 records in
4687+1 records out
307200000 bytes(307 MB) copied, 0.125086 s, 2.5 GB/s
real 0m0.128s
user 0m0.004s
sys 0m0.064s
第四次:
root@brauce-desktop:/mnt/usb# time dd if=/dev/zero of=tmp bs=1024 count=300000
300000+0 records in
300000+0 records out
307200000 bytes(307 MB) copied, 16.0035 s, 19.2MB/s
real 0m16.072s
user 0m0.104s
sys 0m1.120s
root@brauce-desktop:/mnt/usb# time dd if=tmp of=/dev/null bs=64k
4687+1 records in
4687+1 records out
307200000 bytes(307 MB) copied, 0.148483s, 2.1 GB/s
real 0m0.152s
user 0m0.000s
sys 0m0.124s
4. 分析
A. 开发板上结果分析
只分析了第一次:
Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> print(size/1024/1024,"M")
29.296875 M
>>> size=1024*30000
>>> print(size/1024/1024, "M")
29.296875 M
>>> write=size/7.9
>>> print(write/1024/1024, "M")
3.7084651898734173 M
>>> read=size/6.59
>>> print(read/1024/1024,"M")
4.445656297420334 M
>>>
B. Vmware虚拟机上结果分析
不用分析了哦,呵呵,Vmware上的dd命令已经把结果输出来了
PS:
1. 创建设备
#mknod /dev/null c 1 3
#mknod /dev/zero c 1 5
#mknod /dev/random c 1 8
time有计时作用,dd用于复制,从if读出,写到of。if=/dev/zero不产生IO,因此可以用来测试纯写速度。同理of=/dev/null不产生IO,可以用来测试纯读速度。bs是每次读或写
5. 总结:
SD卡:
在开发板上,读速度在3.1MB/s,写的速度在开发板上是740K/s,
而在Vmware中读速度能达到970MB/s-2.3GB/s。 写速度是6.2MB/s
16GBU盘:
在开发板上,读速度在4.4MB/s,写的速度在开发板上是2.1M/s-3.1M/s,
而在Vmware中读速度能达到2.3GB/s。 写速度是9.1MB/s
500GB硬盘:
在开发板上,硬盘的读速度在 4.4MB/s,而写的速度在3.3MB/s.
在Vmware虚拟机中,硬盘的读速度在 2.1GB ,写速度在18.5MB/s左右
之所以出现这样的结果可能是和CPU的处理速度和存储设备的处理速度有关。
注:理论上复制量越大测试越准确。
tip: noetpad没有很多地tab的功能,哈哈。在dev-c++里使用了多行tab功能
注:
1. 给出大量的测试用例,不错的想法。
2. 对文档进行结构化排版,以后看的时候会更清楚一点
本文通过使用dd命令和time工具,在不同环境下进行了磁盘读写速度的详细测试与对比,包括开发板上的SD卡、U盘及500GB硬盘,以及在Vmware虚拟机中的性能表现。
4823

被折叠的 条评论
为什么被折叠?



