Instruments is a powerful tool you can use to collect data about the performance and behavior of one or more processes on the system and track that data over time. Unlike most other performance and debugging tools, Instruments lets you gather widely disparate types of data and view them side by side. In this way you can spot trends that might otherwise be hard to spot with other tools. For example, previously you had to sample a program and analyze its memory behavior during two separate execution runs. In Instruments, you can perform these tasks at the same time. You can then use the resulting data to spot trends between the code being run by your program and its corresponding memory usage.
The Instruments application uses instruments to collect data about a process over time. Each instrument collects and displays a different type of information, such as file access, memory use, and so forth. Instruments includes a library of standard instruments, which you can use as-is to examine various aspects of your code. You can configure instruments to gather data about the same process or about different processes on the system. You can build new instruments using the custom instrument builder interface, which uses the DTrace program to gather the data you want.
Note: Several Apple applications—namely iTunes, DVD Player, and Front Row, and applications that use QuickTime—prevent the collection of data through DTrace (either temporarily or permanently) in order to protect sensitive data. Therefore, you should not run those applications when performing systemwide data collection.
All work in Instruments is done in a trace document. A trace document collects the data gathered by the instruments associated with that document. Each trace document typically holds a single session’s worth of data, which is also referred to as a single trace. You can save a trace document to preserve the trace data you have gathered and open them again later to view that data.
Although most instruments are geared towards gathering trace data, one of the most sophisticated instruments helps automate the collection of data. Using the User Interface instrument, you can record user events while you gather your trace data. You can use this recording to reliably reproduce the same sequence of events over and over again. Each time you run through this sequence, your trace document gathers a new set of trace data from the other instruments in the document and presents that data side by side with previous runs. This feature lets you compare trace data as you make improvements to your code and verify that the changes you make are having the desired impact.
Launching Instruments
Creating a Trace Document
A Tour of the Trace Document Window
Example: Performing a Quick Trace
What’s Next?
Last updated: 2008-02-08