在 Android 上评估 systrace 的输出 [英] Evaluating output from systrace on Android

查看:63
本文介绍了在 Android 上评估 systrace 的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在我的应用程序中追踪一些丢帧..我转向 systrace 寻求帮助,但不幸的是,我的输出并不聪明..

I am currently chasing some dropped frames in my app..I turned to systrace for help, but unfortunately I am not smart from its output..

这是我的跟踪视图..

我的问题基本上是在我的适配器中我创建了相当大的列表项..这意味着当滚动适配器一段时间什么都不做,然后它必须创建相当大的视图..甚至我做了很多优化(obvi 我做了回收,我基本上避免了所有冗余的对象实例化,..),有一些丢帧..它必须花费超过 16 毫秒:/

My problem is basically that in my adapter I am creating quite large list items..That means when scrolling the adapter does nothing for some time and then it has to create quite large view..And even I did a lot of optimizations (obvi I do recycling, I avoided basically all redundant object instantiations,..), there are some dropped frames..It has to take more than 16ms:/

回到我的主要问题..我想我会看到我在 getView 调用期间直接调用到我的适配器的方法的痕迹.但我看不到那里.我做错了什么吗?你从这个跟踪视图中看到我的代码的主要瓶颈在哪里吗?我迷路了:/

back to my main problem..I thought I will see even traces of methods I'm calling right into my adapter during the getView invocation. But I can't see that there. Am I doing anything wrong? Do you see from this traceview where is the main bottleneck of my code? I am lost:/

谢谢..

推荐答案

我想你已经发现了 systrace 必须告诉你的关键:在 pid 527 中,performTraversals 需要 20+毫秒.这似乎在 getDisplayListdrawDisplayList 之间平均分配.

I think you've already spotted the key thing that systrace has to tell you: in pid 527, performTraversals is taking 20+ milliseconds. This seems to be split evenly between getDisplayList and drawDisplayList.

如果您查看 Falcon Pro 案例研究 您会看到许多相似之处,尽管在这种情况下大部分时间都花在了绘图上(因为严重透支).不过,该文章中描述的大多数技术通常都很有用;使用 traceviewhierarchyviewer设备上的开发者选项 以查找低悬的性能问题.

If you look at the Falcon Pro case study you'll see a number of similarities, although in that case the majority of the time was spent drawing (because of major overdraw). Most of the techniques described in that article are generally useful though; use traceview, hierarchyviewer, and the on-device developer options to look for low-hanging performance issues.

如果您想在 systrace 中查看您自己的方法,您可以从 Android 4.3 开始添加您自己的特定于应用程序的标签.有一个例子这里.

If you want to see your own methods in systrace, you can add your own application-specific tags starting in Android 4.3. There is an example here.

这篇关于在 Android 上评估 systrace 的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆