问题
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..
Here is my traceview..
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:/
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:/
Thank you..
回答1:
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
.
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.
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.
来源:https://stackoverflow.com/questions/18704702/evaluating-output-from-systrace-on-android