1、手机连接电脑后,开发者选择-GPU呈现模式分析 - “在adb shell dumpsys gfxinfo中” 或者 “选项线行图”;
2、在APP中快速滑动测试页面,不能停顿,10秒左右;
3、cmd 中 执行命令 adb shell dumpsys gfxinfo 应用包名 > 保存路径及文件名(例如:d:/fps.txt);
4、查看并分析数据,
Draw:消耗在构建java显示列表的时间。它显示出运行方法用的时间诸如View.onDraw(Canvas)。
Process:消耗在Android的2D渲染器执行显示列表的时间。你的视图层次越多,要执行的绘图命令就越多。
Execute:消耗在排列每个发送过来的帧的顺序的时间.这部分的图通常是很小的。
5、把fps.txt中的N条数据取出,每行数据求和后排序;
如果开发app的性能目标就是保持60fps,即Draw+Process+Execute三者和小于16.67毫秒,则时间为1000/60=16.67毫秒。大于16.67则为不通过数据。
列出第三方应用包的列表
macname@MacdeMacBook-Pro lib % adb shell pm list packages -3
例子:
macname@MacdeMacBook-Pro lib % adb shell dumpsys gfxinfo com.taobao.taobao Applications Graphics Acceleration Info: Uptime: 143200345 Realtime: 215416023 ** Graphics info for pid 14309 [com.taobao.taobao] ** Stats since: 143195345787004ns Total frames rendered: 134 Janky frames: 23 (17.16%) 50th percentile: 8ms 90th percentile: 40ms 95th percentile: 105ms 99th percentile: 150ms Number Missed Vsync: 8 Number High input latency: 74 Number Slow UI thread: 12 Number Slow bitmap uploads: 1 Number Slow issue draw commands: 11 Number Frame deadline missed: 15 HISTOGRAM: 5ms=36 6ms=11 7ms=16 8ms=15 9ms=10 10ms=7 11ms=9 12ms=2 13ms=2 14ms=1 15ms=0 16ms=2 17ms=0 18ms=0 19ms=1 20ms=1 21ms=0 22ms=0 23ms=0 24ms=0 25ms=1 26ms=2 27ms=1 28ms=0 29ms=0 30ms=0 31ms=0 32ms=1 34ms=2 36ms=0 38ms=0 40ms=1 42ms=0 44ms=1 46ms=0 48ms=1 53ms=1 57ms=0 61ms=0 65ms=0 69ms=1 73ms=0 77ms=1 81ms=0 85ms=0 89ms=0 93ms=0 97ms=0 101ms=1 105ms=1 109ms=1 113ms=0 117ms=0 121ms=0 125ms=0 129ms=2 133ms=0 150ms=2 200ms=0 250ms=0 300ms=0 350ms=0 400ms=0 450ms=0 500ms=0 550ms=1 600ms=0 650ms=0 700ms=0 750ms=0 800ms=0 850ms=0 900ms=0 950ms=0 1000ms=0 1050ms=0 1100ms=0 1150ms=0 1200ms=0 1250ms=0 1300ms=0 1350ms=0 1400ms=0 1450ms=0 1500ms=0 1550ms=0 1600ms=0 1650ms=0 1700ms=0 1750ms=0 1800ms=0 1850ms=0 1900ms=0 1950ms=0 2000ms=0 2050ms=0 2100ms=0 2150ms=0 2200ms=0 2250ms=0 2300ms=0 2350ms=0 2400ms=0 2450ms=0 2500ms=0 2550ms=0 2600ms=0 2650ms=0 2700ms=0 2750ms=0 2800ms=0 2850ms=0 2900ms=0 2950ms=0 3000ms=0 3050ms=0 3100ms=0 3150ms=0 3200ms=0 3250ms=0 3300ms=0 3350ms=0 3400ms=0 3450ms=0 3500ms=0 3550ms=0 3600ms=0 3650ms=0 3700ms=0 3750ms=0 3800ms=0 3850ms=0 3900ms=0 3950ms=0 4000ms=0 4050ms=0 4100ms=0 4150ms=0 4200ms=0 4250ms=0 4300ms=0 4350ms=0 4400ms=0 4450ms=0 4500ms=0 4550ms=0 4600ms=0 4650ms=0 4700ms=0 4750ms=0 4800ms=0 4850ms=0 4900ms=0 4950ms=0 Font Cache (CPU): Size: 142.04 kB Glyph Count: 40 CPU Caches: GPU Caches: Other: Other: 26.37 KB (1 entry) Buffer Object: 2.05 KB (2 entries) Image: Texture: 25.11 MB (63 entries) Scratch: RenderTarget: 1.69 MB (1 entry) Buffer Object: 48.00 KB (1 entry) Texture: 4.00 MB (1 entry) Other Caches: Current / Maximum VectorDrawableAtlas 0.00 kB / 0.00 KB (entries = 0) Layers Total 0.00 KB (numLayers = 0) Total GPU memory usage: 32372852 bytes, 30.87 MB (17.88 MB is purgeable) Pipeline=Skia (OpenGL) Layout Cache Info: Usage: 419/5000 entries Hit ratio: 2267/2687 (0.843692) Profile data in ms: com.taobao.taobao/com.taobao.tao.TBMainActivity/android.view.ViewRootImpl@d4bec25 (visibility=0) View hierarchy: com.taobao.taobao/com.taobao.tao.TBMainActivity/android.view.ViewRootImpl@d4bec25 280 views, 388.82 kB of display lists Total ViewRootImpl: 1 Total Views: 280 Total DisplayList: 388.82 kB macname@MacdeMacBook-Pro lib %
or
macname@MacdeMacBook-Pro Desktop % macname@MacdeMacBook-Pro Desktop % adb shell dumpsys gfxinfo com.taobao.taobao > a macname@MacdeMacBook-Pro Desktop %