Instruments is a performance-analysis and testing tool for dynamically tracing and profiling OS X and iOS code. It is a flexible and powerful tool that lets you track a process, collect data, and examine the collected data. In this way, Instruments helps you understand the behavior of both user apps and the operating system.
At a Glance
With Instruments, you use special tools (known as instruments) to trace different aspects of a process’s behavior. You can also use the tool to record a sequence of user interface actions in OS X and replay them over and over again to replicate a set of steps, while using one or more instruments to gather data.
Instruments provides the ability to:
Examine the behavior of one or more processes
Record a sequence of OS X user actions and replay them, reliably reproducing those events and collecting data over multiple runs
Profile apps in OS X and in iOS (in iPhone or iPad Simulator, or on a physical iOS device)
Create your own custom DTrace instruments to analyze aspects of system and app behavior
Save user interface recordings and instrument configurations as templates
Using Instruments, you can perform tasks such as:
Track down difficult-to-reproduce problems in your code
Do performance analysis on your app
Find memory leaks and other problems in your app
Automate testing of your app
Stress-test parts of your app
Perform general system-level troubleshooting
Gain a deeper understanding of how your app works
Instruments is available with Xcode 3.0 and later and with OS X v10.5 and later.
Organization of This Document
The following chapters describe how to use Instruments:
Instruments Quick Start explains how to install Instruments and provides a quick example that walks you through gathering data.
Touring Instruments gives a brief overview of the Instruments app and introduces the main window.
Adding and Configuring Instruments describes how to add and configure instruments and run them to collect data on one or more processes.
Collecting Data on Your App describes the ways you can initiate traces and gather trace data.
Examining Your Collected Data describes the tools you use to view the data returned by the instruments.
Saving and Importing Trace Data describes how you save trace documents and data and how you import data from other sources.
Locating Memory Issues in Your App provides examples of how to use the memory-oriented trace templates.
Measuring I/O Activity in iOS Devices provides examples of how to use the I/O-oriented trace templates.
Measuring Graphics Performance in Your iOS Device provides examples of how to use the OpenGL ES–oriented trace templates.
Analyzing CPU Usage in Your App provides examples of how to use the CPU-oriented trace templates.
Automating UI Testing provides examples of how to write scripts for automatic testing of your app.
Creating Custom Instruments shows how to create and configure your own DTrace-based custom instrument.
Preferences provides an overview of the preferences available in Instruments.
Keyboard Shortcuts provides an overview of the keyboard shortcuts available in Instruments.
Menu Bar Definitions provides an overview of the menus in Instruments.
Trace Template Contents provides an overview of the standard trace templates and the instruments they contain.
Instruments is best used in conjunction with Xcode. For information on how to use Xcode, see Xcode Overview. For a complete list of help articles for performing essential Instruments tasks, see Instruments Help.