Android iowait分析

1.介绍

在分析性能稳定性时都会考虑到io影响,主要常见问题:anr swt crash.

比如一个anr issue,假如io在30以上,就可以去查下是否和io有关,假如和有关情况,一般blocked的位置应该是在io文件操作上。

io高有关系的,一般

1.emmc有错误,搜索kernel log关键字mmc mmcqd等

2.mmc读写性能差,可以查看读写速度,以及io加载,也就是下面所讲

3.速度正常,但是确认进行了大量的文件读写,就需要看,同时间这么大大的文件读写是否有问题

2.io log分析

在cpu info或者device log等中看到io高时可以看如下log

@SYS_BLOCKIO
[  351.379013]q:0.rt:50747,24891392,479.wt:2666,163840,60.wl:53%,539709697,1000373849,616.vm:525340,212,487948,0,489692.cpu:1
[  352.594315]q:0.rt:57942,14655488,247.wt:1314,880640,654.wl:74%,902255858,1215304310,343.vm:510496,72,488032,64,489900.cpu:
[  353.600182]q:0.rt:39783,10551296,259.wt:2756,1699840,602.wl:85%,861515012,1005865849,270.vm:506820,256,488224,0,489980.cpu
[  354.601486]q:0.rt:16856,3383296,196.wt:344,258048,729.wl:92%,926333917,1001304849,153.vm:506404,92,488240,152,490008.cpu:1
[  355.602391]q:0.rt:27171,2420736,87.wt:1011,819200,790.wl:87%,880481318,1000902002,232.vm:498176,292,488672,152,490424.cpu:
[  356.608745]q:0.rt:45771,18092032,386.wt:1748,724992,405.wl:78%,791607544,1006354233,355.vm:486780,484,489120,8,490788.cpu:
[  357.652199]q:0.rt:18123,3600384,194.wt:2310,1720320,727.wl:88%,921058140,1043418849,204.vm:481332,272,490400,328,491988.cp

@SYS_BLOCKIO 解析结果
[  351.379013] [BLOCK_TAG] mmcqd:0 Write Throughput=2666 kB/s, size: 163840 bytes, time:60 ms
[  351.379013] [BLOCK_TAG] mmcqd:0 Read Throughput=50747 kB/s, size: 24891392 bytes, time:479 ms
[  352.594315] [BLOCK_TAG] mmcqd:0 Write Throughput=1314 kB/s, size: 880640 bytes, time:654 ms
[  352.594315] [BLOCK_TAG] mmcqd:0 Read Throughput=57942 kB/s, size: 14655488 bytes, time:247 ms
[  353.600182] [BLOCK_TAG] mmcqd:0 Write Throughput=2756 kB/s, size: 1699840 bytes, time:602 ms
[  353.600182] [BLOCK_TAG] mmcqd:0 Read Throughput=39783 kB/s, size: 10551296 bytes, time:259 ms
[  354.601486] [BLOCK_TAG] mmcqd:0 Write Throughput=344 kB/s, size: 258048 bytes, time:729 ms
[  354.601486] [BLOCK_TAG] mmcqd:0 Read Throughput=16856 kB/s, size: 3383296 bytes, time:196 ms

@kernel log
<6>[ 5422.433909] (2)[141:mmcqd/0][BLOCK_TAG] mmcqd:141 Workload=98%, duty 581746690, period 592346900, req_cnt=33 
<6>[ 5422.433948] (2)[141:mmcqd/0][BLOCK_TAG] mmcqd:141 Write Diversity=813787 sectors offset, req_cnt=22, break_cnt=0, tract_cnt=8, bit_cnt=0
<6>[ 5422.433986] (2)[141:mmcqd/0][BLOCK_TAG] mmcqd:141 Read Diversity=49649 sectors offset, req_cnt=11, break_cnt=0, tract_cnt=0, bit_cnt=0
<6>[ 5422.434018] (2)[141:mmcqd/0][BLOCK_TAG] mmcqd:141 Write Throughput=8673 kB/s, size: 5021696 bytes, time:579 ms
<6>[ 5422.434050] (2)[141:mmcqd/0][BLOCK_TAG] mmcqd:141 Read Throughput=57344 kB/s, size: 114688 bytes, time:2 ms

解释:
mmcqd/0  q:0 代表内置存储  1表示外置SD卡
wl:53% Workload 表明当前io的loading
351.379013  表示时间
rt:50747,24891392,479  表示Read Throughput,速度50747 kB/s, size: 24891392 bytes, time:479 ms
wt:2666,163840,60  表示Write Throughput=2666 kB/s, size: 163840 bytes, time:60 ms

关于emmc读写速度,可以问具体的负责人,不过一般读速度低于100M/s 写速度低于5M/s我觉得都有问题

这题write的速度貌似有点低,只有6731 KB/s。这时因为read和write是共有同一个queue,read占了过多资源。
如果throughput都低于10M/s就代表不太正常。如果单一throughput低于10M/s,另一个很高,一般是loading过重。

不过读写比如多个文件的目录时,是比单个文件慢的,需要考虑下

猜你喜欢

转载自blog.csdn.net/wd229047557/article/details/82260585