How to Use Xcode Instruments to Collect Data for iOS Apps

By Rajiv Ramnath

Xcode provides a developer tool that allows dynamic tracing and profiling of iOS code to help you understand the joint behavior of both the app code and the operating system. It is called Instruments. To use this tool, follow these steps:

  1. Choose Xcode→Open Developer Tool→Instruments.

    The Instruments window appears showing a collection of templates.

    You can also access Instruments by clicking and holding the Play button and clicking Profile.

  2. Select Blank Template.

    The Instrumentation window appears showing a blank area with the message Drag recording instruments here from the Library to set up the Trace Document. If the window with the instruments library does not show, click on the little arrow below the above message (labeled Library).

    Adding instruments in the Trace Documents area.

    image0.jpg

  3. Drag and drop one or more instruments from the Library window into the instrumentation canvas.

    The selected instruments appear in the Trace Document area

  4. Select an application to target for the instrumentation.

    How to select a target for the instrumentation:

    image1.jpg

        As a final step, you can see the data collected after you perform an instrumentation run.

image2.jpg