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 one or more processes 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 and replay them, using one or more instruments to gather data.
Instruments includes the ability to:
Examine the behavior of one or more processes
Record a sequence of user actions and replay them, reliably reproducing those events and collecting data over multiple runs
Create your own custom DTrace instruments to analyze aspects of system and app behavior
Save user interface recordings and instrument configurations as templates, accessible from Xcode
Using Instruments, you can:
Track down difficult-to-reproduce problems in your code
Do performance analysis on 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 the Instruments app:
“Instruments Quick Start” describes how to install Instruments and provides a quick example.
“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.
“Monitoring OS X App Activity” provides examples of how to use the behavior-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.
Instruments is best used in conjunction with Xcode. For information on how to use Xcode, see the Xcode Overview. For information on how to configure an instrument and what information it collects, see the Instruments User Reference.