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 also monitors all existing processes and can be used to attach new instruments to specific processes, monitor parent-child process hierarchies, and quit running processes. The Activity Monitor trace template consists of the Activity Monitor instrument.
Use the network statistics in the Activity Monitor instrument to see which processes are sending and receiving information. Examine this information 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.
The Trace Highlights view option does not provide any useful graphs when looking at network connections. To provide useful information, the Activity Monitor instrument must be configured. The following configuration options provide network specific information through the Activity Monitor. For statistic definitions and complete configuration options, see Instruments User Reference.
Net Packets In
Net Bytes In
Net Packets Out
Net Bytes Out
Net Packets In Per Second
Net Packets Out Per Second
Net Bytes In Per Second
Net Bytes Out Per Second
Analyzing Network Connections with the Connection Trace Template
The Networks template analyzes how your apps are using TCP/IP and UDP/IP connections. The Network trace template consists of the Connections and Network Activity instruments.
Connect your iOS device.
You can use a physical or wireless connection. See “To enable a wireless device.”
Choose a target from the Target pop-up menu.
Click Record and exercise your app.
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 amount of bytes used other processes. Switching to the Connection view shows the collected information in column form.
You can compare the amount of data passed by different connections using the Connections instrument (see Figure 8-2). Clicking a checkbox in the Graph column next to a connection displays that information in the track pane. A graph of all connections is always displayed in the track pane.
In conjunction with the Connections instrument, the Network Activity instrument measures the number of packets that are sent and received by your app.