emmc讀寫速度效能分析
阿新 • • 發佈:2018-12-04
環境:linux (aarch64 cpu)
分析:
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 -----------------------------------------------------------------------------------
dd 指令繞開cache引數說明:
如果要規避掉檔案系統cache,直接讀寫,不使用buffer cache,需做這樣的設定
iflag=direct,nonblock
oflag=direct,nonblock
iflag=cio
oflag=cio
direct 模式就是把寫入請求直接封裝成io 指令發到磁碟
非direct 模式,就把資料寫入系統快取,然後就認為io 成功,並由作業系統決定快取中的資料什麼時候被寫入磁碟