Profiling an iPhone application with Shark

Here is a quick checklist

  1. Build app and launch on the device
  2. Launch Shark (perhaps from Spotlight)
  3. From the Shark menu, select Sampling->Network/iPhone Profiling
  4. In the Shark window, select the radio button “Control network profiling of shared computers”.
  5. Select your iPhone in the list and optionally configure the profiling session
  6. Check “Use:” next to your iPhone (the checkbox may take several seconds to respond)
  7. Choose the app running on your iPhone from the “Target” drop down.
  8. Press Start to begin profiling, launch the app activity that you wish to profile, press Stop to end profiling
  9. Be patient while Shark transfers the data  to the Mac (this takes longer than the profiling)
  10. 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.

Happy hunting!


Advertisements

One thought on “Profiling an iPhone application with Shark

  1. I don’t know If I said it already but …Hey good stuff…keep up the good work! 🙂 I read a lot of blogs on a daily basis and for the most part, people lack substance but, I just wanted to make a quick comment to say I’m glad I found your blog. Thanks,)

    A definite great read….

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s