Are there no sampling time profiling tools for iPhone apps?
I've tried tools and shark to profile an iPhone app, but both use a data fetch approach, taking screenshots of thread stacks regularly.
I would prefer to have a complete profiling profile that records every function call and the time spent on functions and their subroutines. It seems intuitively better than getting samples. Something like AQtime on Windows would be great.
So my questions are:
- Can a sample-based profile be trusted and as useful as feature-based profiling?
- Can a tool or shark do this type of profiling?
- Are there other tools that are closer to what I want?
source to share
I found that the timing profiling used by Shark is very accurate for determining what your bottlenecks are in your code. You can adjust the sampling interval to be smaller by showing the Mini Config editor with Config | Show Mini Config Editor
and reducing the sampling time.
Tools in Xcode 3.2 now also have a nice Time Profiler tool, albeit for Mac. I've found that the tools work well for profiling, but samples can crash if the system is under heavy load. I usually start with the tools, considering how easy it is to use, then move on to Shark if I need a more detailed understanding of what's going on.
If you really want to do feature based profiling I would look at DTrace. I have written several articles on configuring Cocoa applications using DTrace here and here . The latter even shows an example of setting the startup time of an iPhone application using a custom DTrace script.
Unfortunately, DTrace does not currently work on the iPhone itself, but you can still collect a lot of interesting information using it by running the application in the simulator. While the exact timing information will nowhere come close to what it has on the device, knowing exactly which methods are executed, how many times and in what order can give some clues as to where to optimize. I use DTrace to provide a different perspective on information collected by Shark and Instruments and to answer specific questions about my application.
source to share