instrument 概述

Instruments is a powerful and flexible performance-analysis and testing tool that’s part of the Xcode tool set. It’s designed to help you profile your iOS, watchOS, tvOS, and macOS apps, processes, and devices in order to better understand and optimize their behavior and performance. Incorporating Instruments into your workflow from the beginning of the app development process can save you time later by helping you find issues early in the development cycle.
Instruments是一个强大而灵活的性能分析和测试工具,它是Xcode工具集的一部分。它旨在帮助您分析iOS、watchOS、tvOS和macOS应用程序、流程和设备,以便更好地了解和优化它们的行为和性能。从应用程序开发过程的一开始就将工具整合到您的工作流程中,可以帮助您在开发周期的早期发现问题,从而节省您以后的时间。

In Instruments, you use specialized tools, known as instruments, to trace different aspects of your apps, processes, and devices over time. Instruments collects data as it profiles, and presents the results to you in detail for analysis.
在Instruments中,您使用专门的工具(称为Instruments)随时间跟踪应用程序、流程和设备的不同方面。Instruments会在其配置文件中收集数据,并将结果详细呈现给您进行分析。
Unlike other performance and debugging tools, Instruments allows you to gather widely disparate types of data and view them side by side. This makes it easier to identify trends that might otherwise be overlooked. For example, your app may exhibit large memory growth caused by multiple open network connections. By using the Allocations and Connections instruments together, you can identify connections that are not closing and thus resulting in rapid memory growth.
与其他性能和调试工具不同,Instruments允许您收集广泛不同类型的数据并并排查看。这使得识别可能被忽略的趋势变得更加容易。例如,由于多个开放网络连接,您的应用程序可能会出现较大的内存增长。通过同时使用分配和连接工具,可以识别未关闭的连接,从而导致内存快速增长。
By using Instruments effectively, you can:
通过有效地使用仪器,您可以:

  • Examine the behavior of one or more apps or processes
    检查一个或多个应用程序或进程的行为
  • Examine device-specific features, such as Wi-Fi and Bluetooth
    检查特定于设备的功能,如Wi-Fi和蓝牙
  • Perform profiling in a simulator or on a physical device
    在模拟器或物理设备上执行分析
  • Track down problems in your source code
    跟踪源代码中的问题
  • Conduct performance analysis on your app
    对应用程序进行性能分析
  • Find memory problems in your app, such as leaks, abandoned memory, and zombies
    查找应用程序中的内存问题,例如泄漏、废弃内存和僵尸
  • Identify ways to optimize your app for greater power efficiency
    确定优化应用程序以提高能效的方法
  • Perform general system-level troubleshooting
    执行一般系统级故障排除
  • Save instrument configurations as templates
    将仪器配置另存为模板
    Although it’s embedded within and may be used with Xcode, Instruments is a separate app, which may be used independently as needed.
    尽管它嵌入在Xcode中并可以与Xcode一起使用,但Instruments是一个单独的应用程序,可以根据需要单独使用。

About the trace document

A trace document is used to organize and configure instruments for profiling, initiate data collection, and view and analyze the results. You create a new trace document by launching Instruments and choosing a profiling template or by initiating profiling from Xcode, the Dock, or the command line. You can also save and reopen trace documents in which you’ve configured instruments and collected data. A trace document can contain a lot of extremely detailed information, and this information is presented to you through a number of panes and areas.
跟踪文档用于组织和配置用于分析的工具、启动数据收集以及查看和分析结果。您可以通过启动Instruments并选择分析模板,或者通过从Xcode、Dock或命令行启动分析来创建新的跟踪文档。您还可以保存并重新打开已在其中配置仪器和收集数据的跟踪文档。跟踪文档可以包含许多非常详细的信息,这些信息通过许多窗格和区域呈现给您


The trace document includes the following main areas:
跟踪文档包括以下主要方面:
Toolbar: Allows you to start, pause, and stop data profiling, add instruments, hide and show panes, and more. See About the trace document toolbar.
工具栏:允许您启动、暂停和停止数据分析、添加工具、隐藏和显示窗格等。请参见关于跟踪文档工具栏。
Timeline pane: Displays a graphical summary of the data recorded for a given trace. See About the trace document timeline pane.
时间轴窗格:显示为给定跟踪记录的数据的图形摘要。请参见关于跟踪文档时间轴窗格。
Detail pane: Shows detailed information about the data collected by the instruments in your trace document. See About the trace document detail pane.
详细信息窗格:显示跟踪文档中仪器收集的数据的详细信息。请参见关于跟踪文档详细信息窗格。
Inspector pane: Contains summary information about the current data record and instrument specific extended detail. See About the trace document inspector pane.
Inspector窗格:包含有关当前数据记录和仪器特定扩展详细信息的摘要信息。请参见关于跟踪文档检查器窗格。

About the trace document toolbar

The toolbar of the trace document lets you start, pause, and stop data profiling, add instruments, hide and show panes, and more.
跟踪文档的工具栏允许您启动、暂停和停止数据分析、添加工具、隐藏和显示窗格等。
The toolbar includes the following main elements:
工具栏包括以下主要元素:

  • Profiling controls: Allow you to record, pause, and stop data collection.
    分析控件:允许您记录、暂停和停止数据收集。
  • Target device list: Allows you to select the device on which you wish to profile.
    目标设备列表:允许您选择要配置文件的设备。
  • Target process list: Allows you to select the process or processes to profile.
    目标流程列表:允许您选择要评测的一个或多个流程。
  • Activity viewer: Shows the number of runs for the trace document and the elapsed time of the current trace.
    活动查看器:显示跟踪文档的运行次数和当前跟踪的运行时间。
  • Add Instrument button (+): Shows or hides the instruments Library palette, which contains a complete list of available instruments. From here, you can select individual instruments and add them to your trace document.
    添加仪器按钮(+):显示或隐藏仪器库调色板,其中包含可用仪器的完整列表。从这里,您可以选择单个仪器并将其添加到跟踪文档中。
  • View buttons (): Hide or show the detail pane and inspector.
    查看按钮():隐藏或显示详细信息窗格和检查器。

About the trace document timeline pane

关于跟踪文档时间轴窗格
The timeline pane displays a graphical summary of the data recorded for a given trace. In this pane, each instrument, CPU core, or thread has its own “track,” which provides a graphical chart of the data collected.
时间轴窗格显示为给定跟踪记录的数据的图形摘要。在此窗格中,每个仪器、CPU核心或线程都有自己的“轨迹”,它提供了所收集数据的图形图表。
Although this pane’s information is read-only, you can scroll through data, select specific areas for closer examination, and insert flags to highlight points of interest. You can change how graphical information is displayed here by adjusting the zoom level or by changing the display settings of individual instruments using the display configuration popover. An optional filter bar provides controls for filtering the data displayed by an instrument. For example, the Sampler instrument can filter the data by thread.
尽管此窗格的信息是只读的,但您可以滚动浏览数据,选择特定区域进行更仔细的检查,并插入标志以突出显示感兴趣的点。您可以通过调整缩放级别或使用显示配置弹出窗口更改单个仪器的显示设置来更改此处图形信息的显示方式。可选的筛选栏提供用于筛选仪器显示数据的控件。例如,采样器仪器可以通过线程过滤数据。
You can pin timelines to the bottom of the pane to keep important information visible as you investigate issues. For example, you can pin the Leaks instrument to the bottom of the pane, and then scroll through the other instruments to find the possible causes for a leak. Pinned instruments are not preserved between runs.
您可以将时间线固定在窗格底部,以便在调查问题时查看重要信息。例如,您可以将泄漏仪器固定在窗格底部,然后滚动其他仪器以查找泄漏的可能原因。在两次运行之间不保留固定的仪器。

Strategy views
战略观点
Click the strategy buttons in the filter bar to display instruments, CPU core, thread data, or all three items in the timeline.
单击过滤器栏中的策略按钮以显示仪器、CPU核心、线程数据或时间线中的所有三个项目。
** All** : Show data for instruments, threads, and CPUs in the timeline.
全部:在时间轴中显示仪器、线程和CPU的数据。
CPUs: Displays a list of CPU cores, along with their usage over time, in the timeline pane. Only available when a trace document contains instruments that record CPU data.
CPU:在时间轴窗格中显示CPU核心的列表及其随时间的使用情况。仅当跟踪文档包含记录CPU数据的仪器时可用。

Instruments: Displays a list of instruments and their corresponding data in the timeline pane.
仪器:在时间轴窗格中显示仪器及其相应数据的列表。
If you select an instrument in the list, you can delete it or configure it in the inspector pane. The instruments list is visible by default when you create a trace document.
如果在列表中选择仪器,则可以在inspector窗格中删除或配置它。创建跟踪文档时,默认情况下仪器列表可见。


Threads: Displays a list of threads and their utilization data in the timeline pane. Only available when a trace document contains instruments that record thread data.
线程:在时间轴窗格中显示线程及其利用率数据的列表。仅当跟踪文档包含记录线程数据的工具时可用。

About the display configuration popover

关于显示配置popover
Use the display configuration popover to configure what data is displayed in the timeline and to configure the format of the displayed data.
使用“显示配置”弹出窗口来配置时间线中显示的数据以及所显示数据的格式。
The settings available in the display configuration popover vary, depending on the instrument. These settings can help you:
显示配置弹出窗口中的可用设置因仪器而异。这些设置可以帮助您:
Control the data that appears in the timeline. For example, the Activity instrument allows you to toggle the display of total threads, VM size, and several other system statistics.
控制时间线中显示的数据。例如,Activity instrument允许您切换总线程、VM大小和其他几个系统统计信息的显示。
调整记录的信息在时间轴视图中的表示方式。例如,仪器可能允许您在峰值图和块图之间切换。
Adjust how recorded information is represented in the timeline view. For example, an instrument may allow you to switch between a peak graph and a block graph.
要打开弹出窗口,请单击跟踪文档时间轴窗格中的仪器图标。当指针移动到图标上方时,支持显示配置弹出框的仪器将显示指示器。
To open the popover, click the instrument icon in the trace document timeline pane. Instruments that support a display configuration popover show an indicator when the pointer is moved over the icon.

About the trace document detail pane

关于跟踪文档详细信息窗格
The detail pane shows detailed information about the data collected by the instruments in your trace document. Select an individual instrument in the timeline pane to see the data it collected while profiling.
详细信息窗格显示跟踪文档中仪器收集的数据的详细信息。在时间轴窗格中选择单个仪器,以查看其在分析时收集的数据。
The detail pane consists of three main areas, the navigation bar, the collected data area, and the filter and configuration bar.
详细信息窗格由三个主要区域组成:导航栏、收集的数据区域以及过滤器和配置栏。

Navigation bar
导航栏
The navigation bar at the top of the detail pane helps you browse through collected data.
详细信息窗格顶部的导航栏可帮助您浏览收集的数据。
You can use the navigation bar to switch between types of data and to navigate through different levels of data.
您可以使用导航栏在数据类型之间切换,并在不同级别的数据之间导航。

  • Instrument: Icon of the currently selected instrument in the timeline pane. Click this to view the console for the instrument.
    仪器:时间轴窗格中当前选定仪器的图标。单击此按钮可查看仪器的控制台。
  • Detail type list: Allows you to navigate between different types of data. The options displayed here vary, depending on the actively selected instrument. For many instruments, the list includes things like a summary of data, a call tree, and a console.
    详细信息类型列表:允许您在不同类型的数据之间导航。此处显示的选项因当前选择的仪器而异。对于许多工具,该列表包括数据摘要、调用树和控制台等内容。
    Detail tree: Keep track of where you are in the hierarchy as you navigate through the data in the detail pane. Click a branch of the tree to move back up the hierarchy to the corresponding data.
    详细信息树:在详细信息窗格中浏览数据时,跟踪您在层次结构中的位置。单击树的一个分支,将层次向上移动到相应的数据。

Collected data area
收集数据区
The collected data area shows you all of the data for the selected instrument, typically in tabular format. The content displayed here varies significantly from instrument to instrument. For example, the Activity Monitor instrument displays process, CPU, and thread information, and much more.
Collected data area
采集的数据区域显示所选仪器的所有数据,通常采用表格格式。此处显示的内容因仪器而异。例如,ActivityMonitor工具显示进程、CPU和线程信息等等。

Often, individual symbols and data points within this area contain navigation buttons (), which appear when you move your pointer over them. You can click these buttons to move deeper into the data. As you do, the detail tree in the navigation bar updates to reflect where you are in the hierarchy.
通常,此区域内的单个符号和数据点包含导航按钮(),当您将指针移到这些按钮上时,会显示这些按钮。您可以单击这些按钮来深入数据。执行此操作时,导航栏中的详细信息树将更新,以反映您在层次结构中的位置。

Filter and configuration bar
过滤器和配置栏
The filter and configuration bar at the bottom of the detail pane helps you filter the collected data and configure how that data is displayed.
详细信息窗格底部的筛选器和配置栏可帮助您筛选收集的数据并配置该数据的显示方式。

  • Filter field: Allows you to filter collected data for a specific term. Click the filter field’s menu for some additional filtering options. You can also filter collected data more extensively by adjusting display settings in the display configuration popover.
    过滤器字段:允许您为特定术语过滤收集的数据。单击“过滤器”字段的菜单可获得一些其他过滤选项。还可以通过调整“显示配置”弹出窗口中的显示设置,更广泛地过滤收集的数据。
  • Display configuration controls: Refine the displayed results by filtering, sorting, and data mining. The controls vary from instrument to instrument and can include menus for selecting different views of the results, and popovers for constraining the data that is shown.
    显示配置控件:通过筛选、排序和数据挖掘细化显示的结果。控件因仪器而异,可以包括用于选择结果不同视图的菜单,以及用于约束显示数据的弹出框。

About the trace document inspector pane

关于跟踪文档检查器窗格
The inspector pane contains information about the run that’s currently displayed in the detail pane. It includes information about the recording and, for some instruments, additional details about the selected data.
inspector窗格包含有关当前显示在详细信息窗格中的运行的信息。它包括有关记录的信息,对于某些仪器,还包括有关所选数据的其他详细信息。

Run information area
运行信息区
The run information area shows information about the run displayed in the detail pane including the target, recording time, and the settings used for the recording.
“跑步信息”区域显示详细信息窗格中显示的跑步信息,包括目标、录制时间和录制所用的设置。

Extended detail area
扩展细节区域
The extended detail area is used to display additional instrument-specific information about selected data in the detail pane, such as a complete stack trace.
扩展详细信息区域用于在详细信息窗格中显示有关选定数据的其他仪器特定信息,例如完整的堆栈跟踪。

About the Library palette

关于库调色板
The Library palette provides a complete list of available instruments and lets you add them to your trace documents. Here, you can browse instrument descriptions and filter for a specific instrument.
库调色板提供了可用仪器的完整列表,并允许您将其添加到跟踪文档中。在这里,您可以浏览特定仪器的仪器说明和过滤器。
To display the Library palette, choose Window > Library, press Command-L, or click the Add Instrument button (+) in the trace document toolbar.
要显示库选项板,请选择窗口>库,按Command-L,或单击跟踪文档工具栏中的添加仪器按钮(+)。

About the Flags palette

关于旗帜调色板
The Flags palette displays a list of any flags you may have applied in the timeline pane of the active trace document.
“标志”选项板显示您可能已在活动跟踪文档的时间轴窗格中应用的任何标志的列表。
In the Flags palette, you can select a flag to quickly navigate to it in the timeline. You can also filter through a large list of flags for a specific one, show and hide your flags, and view timestamp information about your flags.
在“标志”选项板中,可以选择一个标志,以便在时间线中快速导航到该标志。您还可以筛选特定标志的大型标志列表,显示和隐藏标志,以及查看有关标志的时间戳信息。

About profiling templates

关于分析模板
In Instruments, you use profiling templates to analyze your app. A profiling template is a trace document that has been preconfigured with instruments and settings for performing a common type of trace.
在Instruments中,您使用分析模板来分析应用程序。分析模板是一个跟踪文档,它已预先配置了用于执行常见类型跟踪的工具和设置。
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.关于分析模板
当您启动仪器、创建新文档或从Xcode启动跟踪时,可以使用分析模板。如果您有更高级或自定义的需求,也可以创建自己的模板。

About the profiling template selection dialog

关于“分析模板选择”对话框
When Instruments launches, you’re presented with a list of profiling templates—files containing sets of preconfigured instruments—from which to choose. This list includes a set of standard templates as well as any custom templates you may have created.
当Instruments启动时,您将看到一个分析模板文件列表,其中包含可供选择的预配置仪器集。此列表包括一组标准模板以及您可能已创建的任何自定义模板。
The profiling template selection dialog consists of the following primary elements.
“分析模板选择”对话框由以下主要元素组成。

  • Target device list: Click this to select the device on which you wish to profile.
    目标设备列表:单击此按钮可选择要配置文件的设备。
  • Target process list: Click this to select the process or processes to profile.
    目标流程列表:单击此按钮可选择要分析的一个或多个流程。
  • Filter buttons: Click these to filter down the list of templates to display just the standard templates, custom templates, or recently used templates.
    筛选按钮:单击这些按钮可筛选模板列表,以仅显示标准模板、自定义模板或最近使用的模板。
  • Search field: Enter some text to quickly find the template you need. This searches template titles and descriptions.
    搜索字段:输入一些文本以快速找到所需的模板。这将搜索模板标题和说明。
  • Template list: The list of profiling templates, which may be filtered if you clicked a filter button or entered search criteria.
    模板列表:分析模板的列表,如果单击筛选按钮或输入搜索条件,则可能会对其进行筛选。
  • Template description: A short description of the currently selected profiling template, which can be helpful for determining whether the selected template meets your needs.
    模板说明:对当前所选分析模板的简短说明,有助于确定所选模板是否满足您的需要。
  • Choose button: Click this to create a new profile document, based on the currently selected template.
    选择按钮:单击此按钮可基于当前选定的模板创建新的配置文件文档。
  • This button changes to Profile when you press the Option key. Click the Profile button to create a new document based on the currently selected template and immediately begin profiling the target process.
    按下选项键时,此按钮将更改为配置文件。单击Profile按钮,根据当前选择的模板创建新文档,并立即开始分析目标流程。
  • Open button: Click this to open a previously saved profile document, rather than starting with a fresh template.
    打开按钮:单击此按钮可打开以前保存的配置文件文档,而不是从新模板开始。
  • Cancel button: Click this to close the template selection dialog.
    取消按钮:单击此按钮关闭模板选择对话框。
    Note: You can display profiling template selection dialog at any time by choosing File > New (or pressing Command-N).
    注意:您可以通过选择文件>新建(或按Command-N)随时显示分析模板选择对话框。

About the Preferences window

关于首选项窗口
The preferences window is used to control various settings related to the behavior of Instruments.
“首选项”窗口用于控制与仪器行为相关的各种设置。
In the preferences window, you can adjust general settings that pertain to startup, saving, and more. You can also adjust recording settings, CPU settings, and symbol preferences.
在“首选项”窗口中,可以调整与启动、保存等相关的常规设置。您还可以调整录制设置、CPU设置和符号首选项。

Instrument(一)相关推荐

  1. Java字节码instrument研究

    MyAgent项目 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="h ...

  2. java.lang.instrument 学习(一)

    [+] 转自:http://jiangbo.me/blog/2012/02/21/Java-lang-instrument/ Instrumentation介绍: Java Instrumentati ...

  3. [转]java.lang.instrument 学习(一)

    [转]java.lang.instrument 学习(一)  收藏 sunyh 发表于 10个月前 阅读 40 收藏 3 点赞 1 评论 0 转自:http://jiangbo.me/blog/201 ...

  4. java.lang.Instrument 动态修改替换类代码

    java.lang.Instrument 动态修改替换类代码 | java.lang.Instrument包是在JDK5引入的,程序员通过修改方法的字节码实现动态修改类代码. 这通常是在类的main方 ...

  5. java.lang.Instrument 代理Agent使用

    原文出处: 陶邦仁 java.lang.Instrument包是在JDK5引入的,程序员通过修改方法的字节码实现动态修改类代码.这通常是在类的main方法调用之前进行预处理的操作,通过java指定该类 ...

  6. java入参为方法_Java命令注入原理结合Java Instrument技术(FreeBuf首发)

    一.前言 命令注入:恶意用户构造恶意请求,对一些执行系统命令的功能点进行构造注入,从而达到执行命令的效果. 二.演示环境搭建 这里采用springboot+swagger搭建一个模拟的web环境:启动 ...

  7. java 上溯_java中Instrument的上溯造型

    继承最值得注意的地方就是它没有为新类提供方法.继承是对新类和基础类之间的关系的一种表达.可这样总结该关系:"新类属于现有类的一种类型". 这种表达并不仅仅是对继承的一种形象化解释, ...

  8. java Instrument修改字节码实现aop功能

    Agent工程2个类: public class MyAgent {/*** 该方法在main方法之前运行,与main方法运行在同一个JVM中* 并被同一个System ClassLoader装载* ...

  9. 定义一个Instrument(乐器)类,并使用共有的play()方法,再分别定义子类 管乐器 打击乐器 弦乐器,使用重写play方法,实现每种乐器的独特play方式。

    package Extends; public class Instrument { public void play(){ System.out.println("使用乐器!") ...

  10. 【JVM】字节码与ASM字节码增强、Instrument实现类的动态重加载

    目录 字节码与ASM字节码增强 什么是字节码? 字节码结构 操作数栈与字节码 字节码增强 ASM 运行时类加载 Instrument JPDA与JVMTI instrument实现热加载的过程 字节码 ...

最新文章

  1. 洛谷 P4151 BZOJ 2115 [WC2011]最大XOR和路径
  2. 服务器相关命令整理[不断更新ing]
  3. [网络安全自学篇] 二十九.文件上传和IIS6.0解析问题及防御原理(二)
  4. sublime-text3按tab跳出括号
  5. java 如何结束线程_java中,如何安全的结束一个正在运行的线程?
  6. 你们都会的防抖与节流
  7. python类中的self参数和cls参数
  8. 编写一个java程序在屏幕上输出,编写一个Java程序在屏幕上输出“This is java!”。...
  9. 基于AISAS模式的用户分析研究
  10. Atitit 研发体系 之道 attilax著 艾龙著 1. 发管理是一个完整的管理体系,从结构上来讲,它主要由四个方面的内容构架而成:组织结构与岗位设置 管理流程与工作流程、、项目及管道管理(
  11. 一种深度学习方法---迁移学习
  12. Fabric-solo on k8s
  13. Chrome 清除特定网站的 cookie
  14. 18级的谷歌卫星地图纹理如何匹配到15级的高程
  15. XStream java.lang.ClassNotFoundException 问题解决
  16. Unity3D-实战-01坦克大战-day03箱式对撞机、钢体、2D渲染层级问题、重力问题(出现坠落现象)、旋转问题、左右上下冲突问题、抖动问题
  17. Selenium_Python实践遇到的问题一:页面存在多窗口时,window_handles属性在保存窗口句柄列表时的顺序不一定和打开页面的顺序一致
  18. zjfc---1120 对称串
  19. java获取客户端IP地址工具类
  20. 武侠玄幻之无极剑仙(一)

热门文章

  1. 华为Mate 30高光还是暗淡,留给华为的时间不多了
  2. 18.Python字符串类型及常用内置方法
  3. 数据名称:“中国健康与营养调查”CHNS数据数据时间跨度:89-15年20世纪90年代,原中国预防医学科学院营养与食品卫生研究所与美国北卡罗来纳大学合作开展了大型开放式队列研究项目“中国健康与营养
  4. 洛谷oj题单【入门2】分支结构-入门难度(Java)
  5. 进销存软件单机两台或多台电脑能用吗
  6. Python爬取斗鱼直播信息
  7. 全国大学生数学建模竞赛2011B题交巡警服务平台的设置与调度MATLAB程序与LINGO程序
  8. C#进程调度的模拟实现:模拟先来先服务调度算法、短作业优先调度算法和优先级调度算法(考虑非抢占式和抢占式),进行算法评价,输出调度结果和算法评价指标。
  9. TensorFlow2 | 并联神经网络-例子
  10. 如何选择PLC?主要从这8个方面入手