1)linux系统的启动,从bootloader到linux kernel startup,最后挂载rootfs。整个过程的启动速度,除去软件驱动因素,若是emmc boot,硬件因素为emmc的读写速度+cache性能
2)分清楚是为①测启动速度的emmc读写速度性能,还是是②光是只是侧emmc的读写速度?
dd指令测试emmc boot下带cache读写速度:
-----------------------------------------------------------------------------------------
$time dd if=/dev/mmcblk0 of=/dev/null bs=128k count=8192
8192+0 records in
8192+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 4.89949 s, 219 MB/s
real 0m4.916s
user 0m0.009s
sys 0m1.346s
-----------------------------------------------------------------------------------------
$ time dd if=/home/root/qnx660.7z of=/dev/null bs=64k count=3486 iflag=direct
3486+0 records in
3486+0 records out
228458496 bytes (228 MB, 218 MiB) copied, 1.05751 s, 216 MB/s
real 0m1.076s
user 0m0.000s
sys 0m0.423s
-----------------------------------------------------------------------------------------
$ time dd if=/home/root/qnx660.7z of=/dev/null bs=32k count=3486
3486+0 records in
3486+0 records out
114229248 bytes (114 MB, 109 MiB) copied, 0.567051 s, 201 MB/s
real 0m0.587s
user 0m0.006s
sys 0m0.140s
-----------------------------------------------------------------------------------------
$ time dd if=/dev/zero of=/dev/mmcblk0 bs=128k count=8192 conv=fdatasync
8192+0 records in
8192+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 24.1659 s, 44.4 MB/s
real 0m24.171s
user 0m0.001s
sys 0m2.631s
-----------------------------------------------------------------------------------------
$time dd if=/dev/zero of=/home/root/rdtest64.bin bs=64k count=3486 conv=fdatasync
3486+0 records in
3486+0 records out
228458496 bytes (228 MB, 218 MiB) copied, 2.51949 s, 90.7 MB/s
real 0m2.549s
user 0m0.013s
sys 0m0.782s
-----------------------------------------------------------------------------------------
$time dd if=/dev/zero of=/home/root/rdtes32.bin bs=32k count=3486 conv=fdatasync
3486+0 records in
3486+0 records out
114229248 bytes (114 MB, 109 MiB) copied, 1.55727 s, 73.4 MB/s
real 0m1.581s
user 0m0.004s
sys 0m0.624s
-----------------------------------------------------------------------------------------
dd指令测试emmc不带cache读写速度:
-----------------------------------------------------------------------------------
$ time dd if=/dev/mmcblk0 of=/dev/null bs=128k count=8192 iflag=direct,nonblock
8192+0 records in
8192+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 16.226 s, 66.2 MB/s
real 0m16.229s
user 0m0.006s
sys 0m1.509s
-----------------------------------------------------------------------------------
$time dd if=/testdata.bin of=/dev/null bs=64k count=3486 iflag=direct,nonblock
3486+0 records in
3486+0 records out
228458496 bytes (228 MB, 218 MiB) copied, 6.84261 s, 33.4 MB/s
real 0m6.845s
user 0m0.004s
sys 0m0.264s
-----------------------------------------------------------------------------------
$time dd if=/testdata.bin of=/dev/null bs=32k count=3486 iflag=direct,nonblock
3486+0 records in
3486+0 records out
114229248 bytes (114 MB, 109 MiB) copied, 3.44524 s, 33.2 MB/s
real 0m3.448s
user 0m0.000s
sys 0m0.145s
------------------------------------------------------------------------------------
RD
-------------------------------------------------------------------------------------
$time dd if=/dev/zero of=/data/testwd0.bin bs=128k count=8192 oflag=direct,nonblock
8192+0 records in
8192+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 22.535 s, 47.6 MB/s
real 0m22.538s
user 0m0.022s
sys 0m1.533s
-----------------------------------------------------------------------------------
$time dd if=/dev/zero of=/data/testwd1.bin bs=64k count=3486 oflag=direct,nonblock
3486+0 records in
3486+0 records out
228458496 bytes (228 MB, 218 MiB) copied, 4.71893 s, 48.4 MB/s
real 0m4.722s
user 0m0.000s
sys 0m0.361s
-----------------------------------------------------------------------------------
$time dd if=/dev/zero of=/data/testwd2.bin bs=32k count=3486 oflag=direct,nonblock
3486+0 records in
3486+0 records out
114229248 bytes (114 MB, 109 MiB) copied, 2.53573 s, 45.0 MB/s
real 0m2.538s
user 0m0.005s
sys 0m0.243s
-----------------------------------------------------------------------------------
如果要规避掉文件系统cache,直接读写,不使用buffer cache,需做这样的设置
iflag=direct,nonblock
oflag=direct,nonblock
iflag=cio
oflag=cio
direct 模式就是把写入请求直接封装成io 指令发到磁盘
非direct 模式,就把数据写入系统缓存,然后就认为io 成功,并由操作系统决定缓存中的数据什么时候被写入磁盘