Guides and Sample Code

Developer

Instruments User Guide

The Instruments Workflow

Instruments may seem like a complex app. It is, in that it can be used to gather all kinds of useful information about your app, and help you diagnose and resolve problems. However, the overall instrument workflow is relatively simple (see Figure 2-1).

Figure 2-1The Instruments workflow image: ../Art/instruments_workflow_diagram_2x.png

At a high level, it consists of the following main phases:

  1. Set up a trace document containing the desired instruments and settings.

  2. Target a device and an app to profile.

  3. Profile the app.

  4. Analyze the data captured during profiling.

  5. Fix any problems in your source code.

Know When to Use Instruments

While testing your app with Xcode, consult the debug navigator gauges (Figure 2-2) before diving into Instruments. These gauges provide high-level information about your app’s CPU, memory, energy usage, and more. Often, they provide all the information you need to improve performance and resolve common problems quickly. Use Instruments when you need to perform more detailed analysis.

Figure 2-2The CPU debugging gauge in Xcode image: ../Art/xcode_cpu_gauge_2x.png