Access and Use Individual Instruments

前提是你 提交于 2020-01-24 01:12:28

Access and Use Individual Instruments

在跟踪文档中,称为工具的单个数据收集模块随着时间的推移收集有关应用程序、进程或设备的数据。每个工具收集并显示特定类型的信息,如文件访问、内存使用或网络活动。仪器包括大量的仪器库,这些仪器是为了满足大多数开发人员的需要而设计的。高级开发人员,但也可以开发自己的自定义工具,使用DTrace来收集其他数据。Within a trace document, individual data collection modules known as instruments collect data about an app, process, or device over time. Each instrument collects and displays a specific type of information, such as file access, memory use, or network activity. Instruments includes an extensive library of instruments, which are designed to meet the needs of most developers. Advanced developers, however, can also develop their own custom instruments that use DTrace to gather other kinds of data.

NOTE

一些苹果的应用程序iTunes,DVD播放器和应用程序使用QuickTime防止数据通过DTrace为了保护敏感或受版权保护的资料收集。Some Apple apps—iTunes, DVD Player, and apps that use QuickTime—prevent the collection of data through DTrace in order to protect sensitive or copyrighted data.

显示库调色板Display the Library Palette

图书馆的调色板(图8-1)显示所有的工具,你可以添加一个跟踪文件。该库包括所有内置的仪器以及您所定义的任何自定义仪器。The Library palette (Figure 8-1) displays all of the instruments you can add to a trace document. The library includes all of the built-in instruments as well as any custom instruments you may have defined.

Figure 8-1图书馆的调色板The Library palette

显示库调色板To display the Library palette

Do one of the following:

  • 单击跟踪文档工具栏中的“添加工具按钮”(+)。Click the Add Instrument button (+) in the trace document toolbar.

  • 选择窗口>图书馆(或按command-l)。Choose Window > Library (or press Command-L).

在库调色板中找到工具Find Instruments in the Library Palette

图书馆调色板中的工具列表相当长,特别是如果您添加了自己的自定义工具的话。在库面板底部的过滤器领域迅速找到基于它的名字,描述特定的仪器,或关键词(见图8-2)。The list of instruments in the Library palette is quite long, especially if you’ve added your own custom instruments. Use the filter field at the bottom of the Library palette to quickly find a specific instrument based on its name, description, or keywords (see Figure 8-2).

Figure 8-2对库调色板中的工具进行筛选Filtering for instruments in the Library palette

更改库视图模式Change the Library View Mode

图书馆调色板中的工具可以被视为有或没有名称和描述的图标。点击图标按钮(图片:/艺术/ icon_library_palette_iconview_2x。PNG)在图书馆的调色板的底部显示每个仪器只有图标(见图8-3)。显示图标,名称和描述每个仪器再次单击列表视图按钮The instruments in the Library palette can be viewed as icons with or without names and descriptions. Click the icon view button (

) at the bottom of the library palette to display only the icon for each instrument (see Figure 8-3). To display the icon, name, and description of each instrument again, click the list view button (

).

Figure 8-3The library palette in icon view

在跟踪文档中添加一个工具Add an Instrument to a Trace Document

无论您创建的是基于模板或空白跟踪文档的跟踪文档,都可以向其添加新工具以扩展其功能。Whether you’ve created a trace document that’s based on a template or a blank trace document, you can add new instruments to it in order to expand its functionality.

在跟踪文档中添加一个工具To add an instrument to a trace document
  1. 打开所需的跟踪文档。Open the desired trace document.

  2. 显示库调色板。Display the Library palette.

  3. 找到所需的仪器。Find the desired instrument.

  4. 将工具从库调色板拖到跟踪文档中“策略窗格”工具列表中的所需位置。Drag the instrument from the Library palette to the desired position in the strategy pane instruments list in your trace document.

从跟踪文档中删除一个工具Remove an Instrument from a Trace Document

当在跟踪文档中工作时,您可以轻松地删除不再需要的工具。When working in a trace document, you can easily remove instruments you don’t need anymore.

从跟踪文档中删除一个工具To remove an instrument from a trace document
  1. 打开所需的跟踪文档。Open the desired trace document.

  2. 在“策略窗格”工具列表中选择要删除的工具。Select the instrument you want to delete in the strategy pane instruments list.

  3. 按Delete键,或选择工具>删除instrumentname仪器。Press the Delete key, or choose Instrument > Delete instrumentname Instrument.

  4. 当提示时,单击OK确认您确实要删除该工具。When prompted, click OK to confirm that you really want to remove the instrument.

配置仪器的记录设置Configure an Instrument’s Record Settings

只要您将它们添加到跟踪文档中,就可以随时使用它们。然而,在某些情况下,您可能需要自定义工具的设置。例如,您可能希望在使用分配工具进行分析时,调整活动监视器工具的采样率或丢弃空闲内存的事件。可定制的设置,如不同,取决于仪器。许多仪器都包含用来确定仪器本身收集的信息类型的控制。你可以在督察窗格记录设置区域调整这些设置(参见图8-4)。Instruments are typically ready to use as soon as you add them to a trace document. In some cases, however, you might need to customize the settings for an instrument. For example, you may wish to adjust the sampling rate for the Activity Monitor instrument or discard events for free memory while profiling with the Allocations instrument. Customizable settings like these vary, depending on the instrument. Many instruments contain controls for determining what type of information is gathered by the instrument itself. You can adjust these settings in the record settings area of the inspector pane (see Figure 8-4).

Figure 8-4活动监视器仪表的记录设置Record settings for the Activity Monitor instrument

配置仪器的显示设置Configure an Instrument’s Display Settings

在记录跟踪之后,仪器在细节窗格中显示结果。这些结果从仪器到仪器各不相同。它们可能包括诸如摘要、调用树和示例列表之类的内容。通常,这里提供了大量的数据,并且导航可以耗费时间。为了帮助你快速地得到正确的信息,仪器经常(再次取决于仪器)允许你调整和过滤显示的信息。如果设备支持这些操作,他们出现在检查员的窗格显示设置区(参见图8-5)。此处还可以找到配置时间线窗格内容的选项。After recording a trace, Instruments displays the results in the detail pane. These results vary from instrument to instrument. They may include things like a summary, a call tree, and a sample list. Often, a lot of data is presented here, and navigating it can be time consuming. To help get you to the right information quickly, Instruments often (again, it depends on the instrument) allows you to make adjustments to and filter down the information displayed. If an instrument supports these operations, they appear in the display settings area of the inspector pane (see Figure 8-5). Options for configuring the contents of the timeline pane are also found here.

Figure 8-5显示活动监视器仪表的设置Display settings for the Activity Monitor instrument

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!