Profiling an iPhone application with Shark
Here is a quick checklist
- Build app and launch on the device
- Launch Shark (perhaps from Spotlight)
- From the Shark menu, select Sampling->Network/iPhone Profiling
- In the Shark window, select the radio button “Control network profiling of shared computers”.
- Select your iPhone in the list and optionally configure the profiling session
- Check “Use:” next to your iPhone (the checkbox may take several seconds to respond)
- Choose the app running on your iPhone from the “Target” drop down.
- Press Start to begin profiling, launch the app activity that you wish to profile, press Stop to end profiling
- Be patient while Shark transfers the data to the Mac (this takes longer than the profiling)
- In the Time Profile window that Shark opens, select View : Tree (Top-Down)
Tree view provides a very good insight into the percentage of time spent in functions/methods.
Look for those that seem unjustifiably high.
Save the session data for future reference, try to speed up the code and redo the profiling.