2018-07-21 14:03:54 jekenzhuang 阅读数 7263

环境: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 成功,并由操作系统决定缓存中的数据什么时候被写入磁盘

2019-07-01 13:52:25 shalan88 阅读数 465

因项目需求,写了一个读写eMMC 的脚本来测试eMMC 读写速度
写速度测试脚本:
#!/bin/bash
TEST_FILE_SIZE=134217728

Block sizes of 512b 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M 2M 4M 8M 16M 32M 64M

for BLOCK_SIZE in 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216 33554432 67108864
do

Calculate number of segments required to copy

COUNT=((((TEST_FILE_SIZE/$BLOCK_SIZE))
if [ $COUNT -le 0 ];
then
echo"Block size of $BLOCK_SIZE estimated to require COUNTblocks,abortingfurthertests."breakfiecho3>/proc/sys/vm/dropcachesddif=/dev/zeroof=/var/test.dbfbs=COUNT blocks, aborting further tests." break fi echo 3>/proc/sys/vm/drop_caches dd if=/dev/zero of=/var/test.dbf bs=BLOCK_SIZE count=$COUNT;sync
rm /var/test.dbf
sync
done
测试结果:
262144+0 records in
262144+0 records out
134217728 bytes transferred in 7.305 secs (18373405 bytes/sec)

131072+0 records in
131072+0 records out
134217728 bytes transferred in 4.859 secs (27622500 bytes/sec)

65536+0 records in
65536+0 records out
134217728 bytes transferred in 3.894 secs (34467829 bytes/sec)

32768+0 records in
32768+0 records out
134217728 bytes transferred in 3.434 secs (39084952 bytes/sec)

16384+0 records in
16384+0 records out
134217728 bytes transferred in 2.845 secs (47176705 bytes/sec)

8192+0 records in
8192+0 records out
134217728 bytes transferred in 2.851 secs (47077421 bytes/sec)

4096+0 records in
4096+0 records out
134217728 bytes transferred in 2.830 secs (47426759 bytes/sec)

2048+0 records in
2048+0 records out
134217728 bytes transferred in 3.035 secs (44223304 bytes/sec)

1024+0 records in
1024+0 records out
134217728 bytes transferred in 3.277 secs (40957500 bytes/sec)

512+0 records in
512+0 records out
134217728 bytes transferred in 3.023 secs (44398851 bytes/sec)

256+0 records in
256+0 records out
134217728 bytes transferred in 2.680 secs (50081241 bytes/sec)

128+0 records in
128+0 records out
134217728 bytes transferred in 2.869 secs (46782059 bytes/sec)

64+0 records in
64+0 records out
134217728 bytes transferred in 2.981 secs (45024397 bytes/sec)

32+0 records in
32+0 records out
134217728 bytes transferred in 3.095 secs (43365986 bytes/sec)

16+0 records in
16+0 records out
134217728 bytes transferred in 2.985 secs (44964062 bytes/sec)

8+0 records in
8+0 records out
134217728 bytes transferred in 2.915 secs (46043817 bytes/sec)

4+0 records in
4+0 records out
134217728 bytes transferred in 2.914 secs (46059618 bytes/sec)

2+0 records in
2+0 records out
134217728 bytes transferred in 2.957 secs (45389830 bytes/sec)

====================================================================
读eMMC 脚本:
#!/bin/bash
TEST_FILE_SIZE=134217728

Create test file

echo ‘Generating test file…’
BLOCK_SIZE=65536
COUNT=((((TEST_FILE_SIZE / BLOCKSIZE))ddif=/dev/urandomof=/var/test.dbfbs=BLOCK_SIZE)) dd if=/dev/urandom of=/var/test.dbf bs=BLOCK_SIZE count=$COUNT;sync

Block sizes of 512b 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M 2M 4M 8M 16M 32M 64M

for BLOCK_SIZE in 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216 33554432 67108864
do
echo 3>/proc/sys/vm/drop_caches
dd if=/var/test.dbf of=/dev/null bs=$BLOCK_SIZE;sync
done
测试结果:
Generating test file…
2048+0 records in
2048+0 records out
134217728 bytes transferred in 6.330 secs (21203432 bytes/sec)

262144+0 records in
262144+0 records out
134217728 bytes transferred in 1.271 secs (105600100 bytes/sec)

131072+0 records in
131072+0 records out
134217728 bytes transferred in 0.776 secs (172960989 bytes/sec)

65536+0 records in
65536+0 records out
134217728 bytes transferred in 0.482 secs (278460016 bytes/sec)

32768+0 records in
32768+0 records out
134217728 bytes transferred in 0.312 secs (430185025 bytes/sec)

16384+0 records in
16384+0 records out
134217728 bytes transferred in 0.236 secs (568719186 bytes/sec)

8192+0 records in
8192+0 records out
134217728 bytes transferred in 0.200 secs (671088640 bytes/sec)

4096+0 records in
4096+0 records out
134217728 bytes transferred in 0.185 secs (725501232 bytes/sec)

2048+0 records in
2048+0 records out
134217728 bytes transferred in 0.178 secs (754032179 bytes/sec)

1024+0 records in
1024+0 records out
134217728 bytes transferred in 0.154 secs (871543688 bytes/sec)

512+0 records in
512+0 records out
134217728 bytes transferred in 0.295 secs (454975349 bytes/sec)

256+0 records in
256+0 records out
134217728 bytes transferred in 0.351 secs (382386689 bytes/sec)

128+0 records in
128+0 records out
134217728 bytes transferred in 0.267 secs (502688119 bytes/sec)

64+0 records in
64+0 records out
134217728 bytes transferred in 0.232 secs (578524689 bytes/sec)

32+0 records in
32+0 records out
134217728 bytes transferred in 0.293 secs (458080982 bytes/sec)

16+0 records in
16+0 records out
134217728 bytes transferred in 0.255 secs (526344031 bytes/sec)

8+0 records in
8+0 records out
134217728 bytes transferred in 0.288 secs (466033777 bytes/sec)

4+0 records in
4+0 records out
134217728 bytes transferred in 0.250 secs (536870912 bytes/sec)

2+0 records in
2+0 records out
134217728 bytes transferred in 0.328 secs (409200390 bytes/sec)
根据上面结果看,不同的block size 读写速度不一样,每个硬件有一个最优的读写速度的size

2014-12-23 11:53:07 joychanger 阅读数 6571

1.1概述

eMMC (Embedded Multi Media Card) 为MMC协会所订立的、主要是针对手机产品为主的内嵌式存储器标准规格。

eMMC的一个明显优势是在封装中集成了一个控制器,它提供标准接口并管理闪存,使得手机厂商就能专注于产品开发的其它部分,并缩短向市场推出产品的时间。

    对于我们来说,eMMC就是一款硬件器件。它的使用可以提高手机对ROM、SD等的访问速度,也就是提高了它们的读写速度。从用户外在使用感受来讲,就是可以提高应用的加载、视频的读取速度等。

1.2性能指标

对其性能的评定,主要指标是:读写速度。

eMMC的评定,首先从硬件指标上可以进行评判。这方面可以通过硬件厂商信息得知。

在同样的硬件下,并确保硬件品质OK的情况下,再进行性能的分析。

目前,较为方便的一种评定方法,是通过Antutu等跑分软件,进行评分。因为没有直接针对eMMC的打分,因此,一般以IO storage的评分为评估指标(以Antutu为例)。

1.3问题分析

一般情况下,

如果遇到相关UX问题,从ftrace的log可以确认出来是系统的问题还是eMMC本身读写数据慢导致。从mobilelog可以看出io loading的情况。

问题一、Ftrace中查看eMMC相关log的具体操作方式是怎样的?

可以参考文档《Ftrace_SMP_User_Mannual.pptx》,里面会有说明怎么看ftrace,需要注意IO WIAT部分。

问题二、Mobile log查看io loading的具体操作方式是怎样的?

搜索“kenrel log workload”,可以看到当时eMMC的loading情况。log如下:

        Line 2232: <6>[   15.844484].(6)[105:mmcqd/0][BLOCK_TAG]mmcqd:105

Workload=58%,duty 292743388, period 501573100, req_cnt=339

        Line 3133: <6>[   16.345710].(2)[105:mmcqd/0][BLOCK_TAG]mmcqd:105

Workload=30%,duty 152168141, period 501210300, req_cnt=284

        Line 3849: <6>[   16.846858].(1)[105:mmcqd/0][BLOCK_TAG]mmcqd:105

Workload=19%,duty 96656541, period 501148600, req_cnt=239

        Line 5093: <6>[   17.355422].(1)[105:mmcqd/0][BLOCK_TAG]mmcqd:105

Workload=16%,duty 85583857, period 508565200, req_cnt=148

        Line 5892: <6>[   17.855788].(3)[105:mmcqd/0][BLOCK_TAG]mmcqd:105

Workload=15%,duty 75225083, period 500369100, req_cnt=267

        Line 6594: <6>[   18.356459].(5)[105:mmcqd/0][BLOCK_TAG]mmcqd:105

Workload=11%,duty 55671082, period 500681100, req_cnt=202

说明:

这里的Workload是指eMMC block i/o的繁忙程度,百分比的统计是统计在固定间隔时间内有多久是在持续做I/O request,有多久是空闲的。如果达到99%,那就说明eMMC block i/o这段时间内完全没有空闲,一直在做读写数据的操作,这时候很容易发生由于blocki/o瓶颈导致的上层APP要访问i/o时可能等待时间较久的问题。block i/o如果performance不佳,在同时有多个thread需要对i/o进行读写时,就可能发生短时间内的卡顿或等待。

1.4问题解决

    由于eMMC是硬件器件,因此,如果确认是eMMC读写速度有问题,解决方式一般就是更换器件。


有任何问题,欢迎留言交流讨论!




EMMC 介绍

阅读数 28058

没有更多推荐了,返回首页