Guides and Sample Code

Developer

Instruments User Guide

On This Page

Profiling Templates

In Instruments, you’ll use profiling templates to analyze your app (see Figure 26-1). A profiling template is a trace document that has been preconfigured with instruments and settings for performing a common type of trace. Profiling templates are available when you launch Instruments, create a new document, or initiate a trace from Xcode. You can also create your own templates if you have more advanced or custom needs.

Figure 26-1The Instruments profiling template selection dialog image: ../Art/instruments_profilingtemplateselection_dialog_2x.png

Blank Profiling Template

image: ../Art/templateBlank_48_2x.png

This is a blank profiling template containing no instruments. Select this template if you can’t find a template to meet your needs, or if you want full control over what individual instruments and configuration settings are used to profile your app.

Activity Monitor Profiling Template

image: ../Art/templateActivityMonitor_48_2x.png

This template monitors the overall CPU, memory, disk, and network usage statistics of the specified process or processes. This template may be used with OS X or iOS.

Instruments Included in Template

Allocations Profiling Template

image: ../Art/templateAllocations_48_2x.png

This template tracks the anonymous virtual memory and heap of a specified process. It provides class names and, optionally, retain and release histories for objects. This template may be used with OS X or iOS.

Instruments Included in Template

Cocoa Layout Profiling Template

image: ../Art/templateCocoaLayout_48_2x.png

This template observes changes made to layout constraint objects in order to determine when and where a layout constraint is not working as intended. This template may be used with OS X only.

Instruments Included in Template

Core Animation Profiling Template

image: ../Art/templateCoreAnimator_48_2x.png

This template uses time profiling to measure graphics performance and CPU usage in an app. This template may be used with iOS only.

Instruments Included in Template

Core Data Profiling Template

image: ../Art/templateCoreData_48_2x.png

This template monitors Core Data activity in the file system, including fetches, cache misses, and saves. This template may be used with OS X only.

Instruments Included in Template

Counters Profiling Template

image: ../Art/templateCounters1_48_2x.png

This template monitors counter (PCM) events using time- or event-based sampling methods. This template may be used with OS X only.

Instruments Included in Template

Energy Log Profiling Template

image: ../Art/templateEnergyDiagnostics1_48_2x.png

This template gathers diagnostics regarding energy usage and the on/off state of major hardware components, such as Bluetooth and Wi-Fi. This template profiles device behavior, not individual app behavior. This template may be used with iOS only.

Instruments Included in Template

File Activity Profiling Template

image: ../Art/templateFileActivity_48_2x.png

This template monitors file and directory activity, including file opens and closes, permission modifications, directory creation, file moves, and more. This template may be used with OS X only.

Instruments Included in Template

Leaks Profiling Template

image: ../Art/templateLeaks_48_2x.png

This template measures general memory usage and checks for leaked memory. It provides statistics on object allocations by class, as well as memory address histories for all active allocations and leaked blocks. This template may be used with OS X or iOS.

Instruments Included in Template

Metal System Trace Profiling Template

image: ../Art/templateMetalSystemTrace_48_2x.png

This template profiles the performance of iOS Metal applications by providing tracing information from the application, driver, and GPU layers. This template may be used with iOS only.

Instruments Included in Template

Network Profiling Template

image: ../Art/templateNetwork_48_2x.png

This template analyzes the TCP/IP and UDP/IP connections an app uses. This template may be used with iOS only.

Instruments Included in Template

OpenGL ES Analysis Profiling Template

image: ../Art/templateOpenGLESAnalysis_48_2x.png

This template measures and analyzes OpenGL ES activity in order to identify performance and other OpenGL ES problems, and offer recommendations for resolving them. This template may be used with OS X or iOS.

Instruments Included in Template

System Trace Profiling Template

image: ../Art/templateSystemTrace_48_2x.png

This template provides comprehensive information about system behavior. It shows when threads are scheduled, and shows thread transitions from user to system code via system calls and memory operations. This template may be used with OS X or iOS.

Instruments Included in Template

  • Points of Interest

  • System Load

  • Thread State Trace

  • Virtual memory Trace

  • System Call Trace

System Usage Profiling Template

image: ../Art/templateSystemUsage_48_2x.png

This template monitors an app and records system I/O activity related to files, sockets, and shared memory. This includes inputs, outputs, duration, backtrace, call tree, and more for each call. This template may be used with iOS only.

Instruments Included in Template

Time Profiler Profiling Template

image: ../Art/templateTimeProfiler_48_2x.png

This template performs low-overhead time-based sampling of running processes. This template may be used with OS X or iOS.

Instruments Included in Template

Zombies Profiling Template

image: ../Art/templateZombies_48_2x.png

This template measures general memory usage of an app, focusing on the detection of over-released objects, known as zombies. It provides statistics on object allocations by class, as well as memory address histories for active allocations. This template may be used with OS X or iOS.

Instruments Included in Template

Instruments Not Included in Standard Profiling Templates

The following instruments are not used in any of the standard profiling templates. If you need to use one of these instruments, create a trace document using the Blank Profiling Template and add the instrument to the document from the Library palette. Or, use a standard profiling template and add the desired instrument to it. See Add an Instrument to a Trace Document.

Xcode Gauge Templates

Xcode includes some additional profiling templates, such as CPU, energy, memory, disk, and network. These templates can be used to profile your app in certain situations. They contain specific sets of instruments and settings designed to allow you to diagnose specific problems you may encounter while running your app from within Xcode. Note that these templates don’t appear in the Instruments list of standard templates. They are accessed via the gauges in Xcode. See Profile from Xcode gauges while debugging to learn how to profile your app using one of these templates.