Measuring I/O Activity in iOS Devices

Apps can be complicated programs with a lot of information being passed between the device and the user. The I/O Activity trace template in Instruments help you see what your app is doing and where it is sending and receiving information. This chapter shows you how to use these trace templates and monitor your app’s activity.

Following Network Usage Through the Activity Monitor Trace Template

The Activity Monitor trace template monitors overall system activity and statistics, including CPU, memory, disk, and network. It consists of the Activity Monitor instrument only, although you can add additional instruments to a trace document you’ve created with the template, if you desire.

By default, the Activity Monitor template isn’t set up to display network activity. Therefore, you need to enable the desired network-related statistics in the Record Settings area in the inspector sidebar for the Activity Monitor instrument to see which processes are sending and receiving information.


There are a number of statistics the Activity Monitor instrument supports, but the following ones are network-specific:

If one of the statistics above doesn’t appear under System Statistics in the Record Settings inspector, locate it under “Select statistics to list” and click its checkbox to include it in the list.

Once you have gathered network activity for your app, examine it carefully to pinpoint areas where your app is sending out excessive amounts of information and therefore tying up valuable device resources. When you minimize the amount of information sent and received, you can benefit from increased performance and response times in your app.

Figure 8-1  Activity Monitor instrument tracing network packets

Analyzing iOS Network Connections with the Network Trace Template

The Network template analyzes how your iOS apps are using TCP/IP and UDP/IP connections. The Network trace template consists of the Connections instrument.

To view network connections used by your app
  1. Connect your iOS device.

    You can use a physical or wireless connection. See To enable an iOS device for wireless profiling.

  2. Choose a target from the Target pop-up menu in the trace document toolbar.

  3. Click Record and exercise your app.

  4. Click Stop.

Selecting Trace Highlights in the detail pane provides two bar graphs: The first bar graph lists the top five active ports and the amount of information that has traveled through them. The second one lists the quantity of bytes used by other processes.

Figure 8-2  Viewing network connections

Switching to the Connection view in the detail pane shows the collected information in column form. By default, the track pane displays a graph of all connections. However, in the Connection view area in the detail pane, you can click checkboxes to graphically organize the data by individual processes, providing a means for comparison.