Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding Traceview

Tags:

android

I am trying to understand how a traceview works. I have tried to analyze a method using the traceview but have a query about it.

I have attached the snapshot of the .trace. It indicates that the majority time is taken by (toplevel) marked in blue. however no further info is available on the same. (when this method is executed or what function it performs.)

traceViewSnapshot

Can anyone please explain to me why its consuming so much time?

Thanks in advance!

like image 466
Manish Khot Avatar asked Jan 21 '11 11:01

Manish Khot


1 Answers

I ran into the same question today trying to find out where the code for "toplevel" was. I'm not an expert here, but here's what I think is happening:

http://www.androidcodesearch.com/acs/source/sdk/traceview/src/com/android/traceview/DmTraceReader.java suggests that "toplevel" is just a grab-bag dump for activity that has no known parent.

This is of course not very helpful for figuring out your problem, since a sizable portion of time seems to be being spent in "self." I would recommend acquiring the android source files for whichever android platform (froyo, ICS, etc.) you are working on and trying to poke around to see what might be taking so much time.

BTW - just to make sure you know, you may be entirely misled by this trace. Your trace is only for 7 milliseconds and is tied to some fancy class loading; I would not trust a traceview for such a limited time span on such matters, and even if accurate I can't possibly imagine why you're worried about taking 7 millis down to 5.

like image 133
jdowdell Avatar answered Oct 26 '22 14:10

jdowdell