Information Technology Reference
In-Depth Information
Chapter 16:Testing Code with
Instruments
In This Chapter
Beginning with Instruments
Exploring the Instruments UI
Using instrument templates
Profiling a live application
Comparing runs
Creating custom templates and instruments
Debugging is ideal for low-level line-by-line fault finding. But it's often useful to take a wider view of application
performance—for example, to identify performance bottlenecks, monitor processor loading, and check for
memory leaks.
The Xcode toolchain includes a powerful and comprehensive helper application called Instruments, used for gen-
eral testing and profiling. Instruments is a general purpose time line-based test rig that supports a selection of
instruments—plug-in test probes that monitor some feature or performance metric.
NOTE
The name of the test application is Instruments, with a capital I. The individual test plug-ins are instruments, with a
small i.
You can combine multiple instruments to create a custom test rig, save the rig for use with other applications,
and save the results of every test run for comparison with other runs. Instruments supports both iOS and OS X
applications, but each OS supports a slightly different selection of instruments.
These are the key benefits of Instruments:
A time line: You can graph and compare the output of multiple instruments simultaneously and watch
supporting charts and tables.
Live testing: You can interact with an application and monitor how user events affect its performance.
Overall system profiling: Some instruments monitor how an application affects system resources as a
whole and how other applications or processes compete with it.
A comprehensive library of instruments: You can monitor performance in almost every possible way.
Automated testing: You can play back scripted events to drive your application.
Search WWH ::




Custom Search