Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
192 views
in Technique[技术] by (71.8m points)

Android Eclipse: Traceview, I just don't get it

I just don't get the various elements of the traceview output, and I can't find a tutorial. Could someone please explain the following with reference to the diagram below:

enter image description here

  1. The width of the bars corresponds to the time the function takes. What does the height correspond to?
  2. What is specific difference between Inclusive and Exclusive. I assumed that inclusive includes the calls of all the children functions?
  3. Would this be true: The sum of (Time per call times Calls) = time the program runs (what about async tasks?)
  4. Can async tasks be ignored when debugging slowdown on the main thread ?
  5. Should the sum of all the percents in Excl% equal 100%?
  6. What happens when there are gaps (white in the midst of black)? Is that when other android processes are running, or just your own async tasks (it looks like the gaps in one are aligned with the filled in part in the other, if thats the case then is there any point in moving intensive tasks to an AsyncTask)?
question from:https://stackoverflow.com/questions/6476991/android-eclipse-traceview-i-just-dont-get-it

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I cant answer all your questions, but I can say...

for #4 no, You're running a single core processor (or at least emulating one) so async tasks on their own thread have to interrupt main thread to get processing time. Any time another thread executes will be "slowdown" on the main thread, so you should be watching that.

for #6, those gaps you see in your main threads execution trace correlate exactly to the times when your asynctask is getting processor time. Again, single core, can only do 1 thread at a time. In this time slice it doesnt look like any other process got any processor time at all, but those threads were still sleeping in the background. Since this was (likely) an emulator, thats common. On a live phone you will see many more :)

I'm also fairly sure for #1 that the height of each spike in the thread's execution is the %processor utilization. For example the main thread's "black" area is system idle. Edit: Ok, i'm for sure now. This is what that is. So in your main thread, that area that is solid pink is solid 100% processor utilization.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...