Navigate the Timeline Pane
他最突出的部分跟踪文件的时间窗格,提出各仪器收集的数据的基于时间的视图(参见图11-1)。这个窗格可以很容易地在你的应用程序中发现趋势和潜在问题领域。例如,内存使用图中的一个尖峰表示应用程序分配的内存比平常多。这个峰值可能是正常的,或者可能表明您的代码创建了比预期的更多的对象或内存缓冲区。诸如泄漏之类的工具也可以识别应用程序不正确处理内存的地方。如果泄漏时间线跟踪是人烟稀少,你知道你的应用程序是正确的行为。如果磁道不是空的,您可能要检查为什么。The most prominent portion of a trace document is the timeline pane, which presents a time-based view of the data gathered by each instrument (see Figure 11-1). This pane makes it easy to spot trends and potential problem areas in your app at a glance. For example, a spike in a memory usage graph indicates a time when your app allocated more memory than usual. This spike might be normal, or it might indicate that your code created more objects or memory buffers than you anticipated. An instrument such as Leaks can also identify where your app is not handling memory properly. If the Leaks timeline track is sparsely populated, you know that your app is behaving properly. If the track is not empty, you might want to examine why.
下面的部分将提供关于时间轴窗格的更多信息,以及如何配置它。The sections that follow provide more information about the timeline pane and how you configure it.
放大缩小Zoom In and Out
如果你已经俘获了大量的跟踪数据,你可以扩大或缩小在时间线面板的详细介绍,让您专注于特定的数据集(参见图11-2)。If you’ve captured a lot of data with a trace, you can expand or contract the detail presented in the timeline pane, allowing you to focus in on a specific subset of data (see Figure 11-2).
做以下其中之一:Do one of the following:
-
要放大或缩小,捏的触控板。To zoom in or out, pinch the trackpad.
-
若要放大或缩小,请使用滚动轮,同时按下位于轨道视图上的指针按下选项键。To zoom in or out, use the scroll wheel while pressing the Option key with the pointer positioned over the track view.
-
若要放大,请按选项键,并拖动希望隔离的数据部分。To zoom in, press the Option key, and drag across the section of data you wish to isolate.
-
若要缩小,请按下控制键,并拖动一段数据。To zoom out, press the Control key, and drag across a section of data.
-
Choose View > Snap Track To Fit (or press Control-Command-Z).
-
Choose View > Increase Deck Size (or press Command-Plus Sign).
当前选择的仪器的轨道高度增加,允许您更详细地查看它。The track for the currently selected instrument increases in height, allowing you to view it in greater detail.
-
Choose View > Decrease Deck Size (or press Command-Minus Sign).
The track for the currently selected instrument decreases in height.
Filter a Range of Data
仪器收集大量的信息,因为它的配置文件。您可以通过设置“详细信息”窗格来快速过滤此数据,以便只显示在特定时间范围内发生的事件。见图11-3。Instruments collects massive amounts of information as it profiles. You can quickly filter this data by setting the detail pane to show only events that occurred within a specific time range. See Figure 11-3.
-
在不使用任何修饰符键的情况下拖动一段数据。只显示您拖动的数据。Drag across a section of data without using any modifier keys. Only the data you drag across is displayed.
仪表突出显示时间线窗格的内容,该窗格位于指定的范围内。Instruments highlights the contents of the timeline pane that fall within the range you specified.
Do one of the following:
-
Click outside the selected range in the timeline pane.
-
Choose View > Clear Inspection Range.
Set Flags
标志允许你快速访问在时间线面板的兴趣点(参见图11-4)。可以向每个标志添加名称和说明。Flags allow you to quickly access points of interest in the timeline pane (see Figure 11-4). You can add a name and description to each flag.
-
Choose Edit > Add Flag (or press Command-Down Arrow).
-
Choose Window > Manage Flags (or press Shift-Command-T) to display the Flags palette.
-
单击标志面板中的一个标志,在时间轴窗格中导航到它。Click a flag in the Flags palette to navigate to it in the timeline pane.
-
Drag the flag out of the timeline navigation bar.
-
Choose Window > Manage Flags (or press Shift-Command-T) to display the Flags palette.
-
Deselect the checkbox next to a flag in the Flags palette to hide it in the timeline pane.
多次运行访问跟踪数据Access Trace Data for Multiple Runs
跟踪文件可以记录数据在你的应用程序运行多个,如图11-5所示。这样做时,它不会丢弃先前记录的数据。A trace document can record data over multiple runs of your app, as shown in Figure 11-5. When doing so, it doesn’t discard previously recorded data.
-
单击策略窗格中工具左侧的“披露三角形”。Click the disclosure triangle to the left of the instrument in the strategy pane.
该工具展开显示一个运行列表。The instrument expands to display a list of runs.
-
单击策略窗格中工具左侧的“披露三角形”。Click the disclosure triangle to the left of the instrument in the strategy pane.
-
在时间线窗格中选择所需的运行轨迹。Select the desired run’s track in the timeline pane.
-
Choose Instrument > Next Run, or press Command-Single Quotation Mark (').
-
Choose Instrument > Previous Run, or press Command-Quotation Mark (").