开发者

How can I profile a monotouch app?

开发者 https://www.devze.com 2023-04-05 21:00 出处:网络
I am trying to analyze a performance issue in my iPhone app with Instruments. I compiled and installed my app in debug mode, created a \"Time Profiler\" and successfully recorded some data of the time

I am trying to analyze a performance issue in my iPhone app with Instruments. I compiled and installed my app in debug mode, created a "Time Profiler" and successfully recorded some data of the time interval in question, but I haven't figured out how to analyze the data I am开发者_运维问答 recording.

I understand how a profiler usually works, I have quite a bit of experience with Rational Quantify, but in this case I am stumped.

What I would like to see: Which of the functions I coded are the cpu performance bottlenecks during the given time period?

What I do see: Lots of seemingly insignficant noise apparently with no relation to my own application's code whatsoever: http://screencast.com/t/3gYOuwua3

I've tried all kinds of filters, but none really helped. How should I proceed?

Thanks,

Adrian


This is so common...

First of all, "Self" time is nearly useless in any real software. All it does is make you look at it and go "gack!".

If you happened to freeze it at a point in time, you would see a call stack many layers deep, and at the tip of the stack it would either be

  • blocked in I/O, sleep, or some other non-computing state, or
  • running the program counter through some library layers far removed from your code.

It is seldom to find the program counter in code you have any control over. So even if you did locate more than a few percent of self time in your code, fixing it can't conceivably save any more than that.

On the other hand, what about the other lines of code on the stack? If you froze it 10 times, and on 5 of those times, a particular line of code was on the stack, you know that line, if you could avoid executing it, would save you 50%, roughly.

I don't look for "slow functions" or "hot spots". The technique I use is this, and there are a lot more reasons why.

0

精彩评论

暂无评论...
验证码 换一张
取 消