zoukankan      html  css  js  c++  java
  • Record, Pause, and Stop Traces

    Record, Pause, and Stop Traces

    仪器在运行时收集有关应用程序的信息。本章介绍如何指导仪器收集信息。Instruments collects information about your app while it’s running. This chapter describes how to direct instruments to collect information.

    记录跟踪Record a Trace

    当你准备好你的应用程序时,你开始录制。在记录时,跟踪文档中的工具根据配置监视应用程序。当记录发生时,时间轴窗格和详细信息窗格更新以提供对所捕获内容的实时视图。When you’re ready to profile your app, you initiate recording. While recording, the instruments in your trace document monitor your app based on their configurations. As recording occurs, the timeline pane and detail pane update to provide a live view of what’s being captured.

    To begin recording

    Do one of the following:

    • Click the Record button (image: ../Art/inline_record_button_2x.png) in the trace document toolbar.

    • Choose File > Record Trace (or press Command-R).

      image: ../Art/instruments_recordtrace_menu_2x.png

      Press Command-R again to stop recording.

    设置录制选项Set Recording Options

    设置记录选项以改进跟踪文档中的数据收集。选择记录之前的延迟,要记录的时间长度,要保存的数据量,或是否以延迟模式记录数据。Set recording options to improve data collection in a trace document. Choose a delay before recording, the length of time to record, the amount of data to save, or whether to record data in deferred mode.

    设置跟踪的记录选项To set the recording options for a trace
    1. Choose File > Record Options to open the Record Options dialog.

      image: ../Art/instruments_recordoptions_menu_2x.png
    2. Customize the settings as desired.

      image: ../Art/instruments_recordoptions_dialog_2x.png

      Options include:

      • 时间限制:最大数量的时间,秒,日期将是仪器记录。Time limit: The maximum amount of time, in seconds, that the instruments will record data.

      • 极限:最大持续时间窗口,在这一秒,数据将被保存。如果你记录你的更长的时间比指定的窗口的限制(例如,超过4秒的时间(日期),只有在最后4秒是保存。Window limit: The maximum duration, in seconds, of data that will be saved. If recording continues for longer than the time you specify as the window limit (for example, longer than 4 seconds), only the data collected during the last 4 seconds is saved.

      • 递延模式:选择推迟到数据分析到数据采集完毕后。这可以导致更快和更精确的数据采集系统,其更多的资源是针对过程被记录。Deferred mode: Select to defer data analysis until after data collection is complete. This can result in faster and more accurate data collection, as more system resources are directed at the process being recorded.

      NOTE

      在这个对话框的一些选项可能被禁用如果不适用的仪器在跟踪文件中的偏好或配置仪器。期权是一种以确定为什么它是残疾人,在盘旋几秒,以查看其内容。Some options in this dialog may be disabled if not applicable to the instruments in the trace document or to the preference configuration in Instruments. To determine why an option is disabled, hover over it for a few seconds to view its tooltip.

      窗口是支持限制在OS X 10.7或以后的版本,在iOS 5或以后。Window Limit is supported in OS X version 10.7 or later and in iOS 5 or later.

    3. 点击OK关闭对话框的记录选项。Click OK to close the Record Options dialog.

    暂停跟踪Pause a Trace

    如有必要,您可以暂停录音,稍后再进行恢复。If necessary, you can pause a recording and resume again at a later time.

    暂停活动记录To pause an active recording

    做以下其中之一:Do one of the following:

    • Click the Pause button (image: ../Art/inline_pause_button_2x.png) in the trace document toolbar.

    • Choose File > Pause Trace (or press Shift-Command-R).

      image: ../Art/instruments_pausetrace_menu_2x.png

    Stop a Trace

    一旦你记录了你想要的数据,停止记录,这样你就可以开始分析收集的数据了。Once you’ve recorded the data you want, stop the recording so you can begin analyzing the collected data.

    停止活动记录To stop an active recording

    Do one of the following:

    • Click the Stop button (image: ../Art/inline_stop_button_2x.png) in the trace document toolbar.

    • Choose File > Stop Trace (or press Command-R).

      image: ../Art/instruments_stoptrace_menu_2x.png

    码头侧面Profile from the Dock

    你可以通过在码头上的仪器应用程序图标触发时间探查器来自动记录背景中的某些事件。You can automatically record certain events in the background by triggering Time Profiler from the Instruments app icon in the Dock.

    从码头收集时间分析器信息To collect Time Profiler information from the Dock
    1. 仪表打开,控制点击仪器图标在码头。With Instruments open, Control-click the Instruments icon in the Dock.

      image: ../Art/instruments_app_icon_small_2x.png
    2. 从出现的快捷菜单中选择要配置的进程以开始记录。From the shortcut menu that appears, choose the process to profile to start recording.

      image: ../Art/instruments_dock_menu_2x.png

      选项包括:Options include:

      • 系统时间分布。开始分析所有系统进程。System Time Profile. Starts profiling all system processes.

      • 时间剖面特定过程。开始时间剖面仪与特定的应用程序的子菜单。Time Profile Specific Process. Starts the Time Profiler instrument with a specific app from the submenu.

      • 自动仿形旋压应用。自动配置阻止(旋转)应用程序在未来。Automatically Time Profile Spinning Applications. Automatically profiles blocked (spinning) apps in the future.

      • 允许跟踪任何进程(10小时)。跟踪在接下来的10小时内发生的任何过程。绕过必须在10小时内输入密码。Allow Tracing of Any Process (10 hours). Trace any process that occurs in the next 10 hours. Bypasses having to enter a password during the 10 hours.

    NOTE

    以这种方式记录的数据保存在。单格式~ /图书馆/技术支持/仪器/ unimported /。Data recorded in this manner is saved in .dtps format to ~/Library/Application Support/Instruments/Unimported/.

    简介从XcodeProfile from Xcode

    工具是Xcode开发工作流的一个关键组成部分,你可以开始直接在Xcode为你建立和测试你的应用程序。Instruments is a key component of the Xcode development workflow, and you can initiate it directly from within Xcode as you build and test your app.

    来自构建和产品菜单的概要文件Profile from the build and product menus

    Xcode创建菜单允许你运行,测试,分析你的应用程序。它还允许你用仪器来显示你的应用程序。The Xcode build menu allows you to run, test, and analyze your app. It also allows you to profile your app with instruments.

    分析你的应用程序从Xcode的构建和产品菜单To profile your app from the Xcode build and product menus
    1. 打开Xcode应用程序项目。Open an app project in Xcode.

    2. Do one of the following:

      • 单击并按住建在Xcode的主窗口菜单,选择弹出菜单中的轮廓。Click and hold the build menu in the Xcode main window, and choose Profile from the menu that appears.

        image: ../Art/xcode_toolbar_build_menu_profile_option_2x.png
      • Choose Product > Profile (or press Command-I).

        image: ../Art/xcode_product_menu_profile_menu_2x.png

      工具启动,分析模板选择对话框出现。请注意,您的应用程序是在目标设备和进程列表中自动选择的。Instruments launches, and the profiling template selection dialog appears. Note that your app is automatically selected in the target device and process lists.

      image: ../Art/instruments_profiling_template_window_initiatedbyxcode_2x.png

    使用默认模板时谱从Xcode构建和产品菜单To use a default template when profiling from the Xcode build and product menus
    1. 打开Xcode应用程序项目。Open an app project in Xcode.

    2. 通过以下操作打开一个计划编辑器对话框:Open the scheme editor dialog by doing one of the following:

      • 选择在Xcode的主窗口工具栏的目标设备列表编辑方案。Select Edit Scheme from the target device list in the Xcode main window toolbar.

        image: ../Art/xcode_targetdevice_list_editscheme_option_2x.png
      • Choose Product > Scheme > Edit Scheme, or press Command–Less Than (<).

        image: ../Art/xcode_product_menu_editscheme_menu_2x.png
    3. 在“计划编辑器”对话框的侧栏中单击“配置文件”对话框。Click Profile in the sidebar of the scheme editor dialog.

      image: ../Art/xcode_scheme_editor_dialog_sidebar_profile_option_2x.png
    4. 从“仪表弹出”菜单中,选择所需的分析模板。From the Instrument pop-up menu, choose the desired profiling template.

      image: ../Art/xcode_scheme_editor_dialog_profile_option_instrument_popup_2x.png
    5. Click Close.

      现在,当您配置应用程序时,工具会自动在您在方案编辑器对话框中选择的模板中打开它,并开始分析。Now, whenever you profile your app, Instruments automatically opens it in the template you selected in the scheme editor dialog and starts profiling.

      image: ../Art/instruments_activitymonitorprofilingfromxcode_2x.png

    简介从Xcode调试gauges whileProfile from Xcode gauges while debugging

    在Xcode调试监视器包括多个gauges导航应用程序的测试和调试你的信息。论文gauges轨迹的各种因素,包括CPU使用情况,内存,和能量的影响,和潜在的问题,可以提醒你可能会影响性能,功耗,和更多。如果你确定你想化的趋势继续在测试您的应用程序,你可以转换在仪器的监测更多的详细的分析。The Xcode debug navigator includes several gauges that monitor an app as you test and debug it. These gauges track a variety of factors, including CPU usage, memory, and energy impact, and can alert you to potential problems that may impact performance, power consumption, and more. If you identify a trend you wish to investigate further while testing your app, you can transition monitoring over to Instruments for more detailed analysis.

    一个重要的谱仪从XcodeTo initiate profiling from an Xcode gauge
    1. 开放的应用程序和运行在Xcode项目中的信息。Open an app project in Xcode and run it.

    2. 当你的应用程序是运行在调试,显示一个导航仪做下面的:While your app is running, display the debug navigator by doing one of the following:

      • 点击导航按钮导航器的调试在选择器栏。Click the Debug Navigator button in the navigator selector bar.

        image: ../Art/xcode_navigatorselector_bar_debugnaviagator_button_2x.png
      • Choose View > Navigators > Show Debug Navigator (or press Command-6).

        image: ../Art/xcode_view_menu_debugnavigator_menu_2x.png
    3. 在调试导航器中单击所需的量规。Click the desired gauge in the debug navigator.

      image: ../Art/xcode_debug_navigator_selectedgauge_2x.png
    4. 在主编辑器中的工具按钮中单击标尺的概要文件。Click the gauge’s Profile in Instruments button in the main editor.

      image: ../Art/xcode_gauge_profileininstruments_button_2x.png

      请注意,并不是每一个Xcode计有轮廓工具按钮。例如,能量冲击测量仪包括几个按钮,用于在仪器中启动不同类型的分析会话。Note that not every Xcode gauge has a Profile in Instruments button. The Energy Impact gauge, for example, includes several buttons for initiating different types of profiling sessions in Instruments.

      image: ../Art/xcode_timeprofiler_gauge_profileininstruments_button_2x.png
    5. 当提示时,选择是否将当前运行的应用程序实例转移到仪表或停止应用程序,并用仪器启动一个新实例。When prompted, select whether to transfer the currently running instance of your app over to Instruments or stop the app and start a new instance of it with Instruments.

      image: ../Art/xcode_profileininstrruments_alert_2x.png

      在这两个案例,说明你的应用程序。profiling Xcode,launches仪器,initiates profiling鸭。如果你选择了两个传送的会话,profiling仪器开始你的应用程序在其当前状态。In both cases, note that Xcode stops profiling your app, launches Instruments, and initiates profiling. If you chose to transfer the session, Instruments begins profiling your app in its current state.

    从命令行配置文件Profile from the Command Line

    简介仪器Profile with instruments

    使用工具命令行工具(参见工具(1)Mac开发人员工具手册页)使用指定的模板来描述应用程序而不需要启动工具。在分析期间收集的数据保存在跟踪文件到指定的目录中。分析完成后,您可以用仪器打开记录的数据文件,以查看数据的可视化表示。Use the instruments command-line tool (see instruments(1) Mac OS X Developer Tools Manual Page) to profile an app using a specified template without launching Instruments. Data gathered during profiling is saved in a .trace file into a specified directory. After profiling is complete, you can open the recorded data file with Instruments to see a visual representation of the data.

    用仪器描绘To profile with instruments
    1. 打开终端,在应用程序/实用程序。Open Terminal, in /Applications/Utilities.

    2. 输入一个工具命令来收集数据。Enter an instruments command to collect data.

      例如,下面的命令使用分配模板对应用程序进行概要分析,并将结果保存到跟踪文件中的桌面上。For example, the following command profiles an app with the Allocations template and saves the results to the desktop in a .trace file.

      • instruments -t "Allocations" -D ~/Desktop/
      • .trace
    3. 仪器- T“分配”Open Instruments, and choose File > Open.

      image: ../Art/instruments_fileopen_menu_2x.png
    4. Find your saved .trace file, and click Open.

      image: ../Art/instruments_opentracefile_dialog_2x.png

      打开保存的文件后,仪器会自动添加相关的工具来跟踪文件和填充他们收集的数据。您可以查看和分析数据,以便找到应用程序中的任何问题。After opening the saved file, Instruments automatically adds the associated instruments to a trace document and populates them with the collected data. You can view and analyze the data in order to locate any issues with your app.

      image: ../Art/instruments_loadedtrace_file_2x.png

    instruments Options

    instruments provides the following set of configuration options for defining what data to collect.

     

    Configuration Option

    Description

    -t template

    在分析应用程序时使用的分析模板的名称或路径。The name or path of the profiling template to use when analyzing your app.

    -s

    Returns a list of all installed profiling templates.

    -D document

    应该保存跟踪文档的路径。如果文件已经存在,新记录的数据将作为新的运行追加到它。The path where the .trace document should be saved. If the file already exists, the newly recorded data is appended to it as a new run.

    -l #

    在终止之前记录的时间,以毫秒为单位。如果没有提供,则记录会无限期地发生,直到应用程序被手动终止为止。The amount of time to record, in milliseconds, before terminating. If not provided, recording occurs indefinitely, until the app is manually terminated.

    -i #

    用于记录的仪器的索引。The index of the instrument to use for recording.

    -p pid

    The process ID of the app to be recorded.

    application

    The path of the app to be recorded.

    -w hardware device

    The ID of the device to target.

    -e variable value

    在分析时应用的环境变量。An environment variable to be applied while profiling.

    argument

    要传递给应用程序的命令行参数。如果需要,可以指定多个参数。A command-line argument to be passed to the app being profiled. Multiple arguments may be specified, if desired.

    -v

    在分析时启用详细日志记录。Enables verbose logging while profiling.

    Collect and view data with iprofiler

    使用iprofiler命令行工具(见iprofiler(1)Mac OS X开发者工具手册页)没有发射仪器测量应用程序的性能。在收集性能数据之后,将其导入到仪器中,以便看到数据的可视化表示。收集的数据是保存在一个iprofiler。单束,可以打开仪器。iprofiler支持以下类型的文件:Use the iprofiler command-line tool (see iprofiler(1) Mac OS X Developer Tools Manual Page) to measure an app’s performance without launching Instruments. After collecting performance data, import it into Instruments in order to see a visual representation of the data. Data collected by iprofiler is saved in a .dtps bundle that can be opened by Instruments. iprofiler supports the following types of profiles:

    • 活动监视器。监控整个系统活动和统计数据,包括CPU、内存、磁盘和网络。活动监视器还监视所有现有进程和父/子进程层次结构。Activity Monitor. Monitors overall system activity and statistics, including CPU, memory, disk, and network. Activity Monitor also monitors all existing processes and parent/child process hierarchies.

    • 分配。通过跟踪分配,包括按类分配特定的对象分配来测量堆内存使用情况。分配也可以按区域记录虚拟内存统计信息。Allocations. Measures heap memory usage by tracking allocations, including specific object allocations by class. Allocations can also record virtual memory statistics by region.

    • 计数器。使用基于时间或事件的采样方法收集性能监视器计数器事件。Counters. Collect performance monitor counter events using time- or event-based sampling methods.

    • 事件探查器。通过低开销、基于事件的采样对系统CPU上运行的进程进行采样。Event Profiler. Samples the processes running on the system’s CPUs through low-overhead, event-based sampling.

    • 泄漏.测量一般内存使用情况,检查漏内存,并按类提供对象分配的统计数据,以及所有活动分配和漏块的内存地址历史记录。Leaks. Measures general memory usage, checks for leaked memory, and provides statistics on object allocations by class as well as memory address histories for all active allocations and leaked blocks.

    • 系统跟踪。提供有关系统行为的全面信息。系统跟踪显示线程何时调度,并通过系统调用或内存操作显示从用户代码到系统代码的所有转换。System Trace. Provides comprehensive information about system behavior. System Trace shows when threads are scheduled and shows all their transitions from user code into system code through either system calls or memory operations.

    • 时间剖面。对系统CPU上运行的进程执行低开销、基于时间的采样。Time Profiler. Performs low-overhead, time-based sampling of processes running on the system’s CPUs.

    收集并iprofiler查看数据To collect and view data from iprofiler
    1. 打开终端,在应用程序/实用程序。Open Terminal, in /Applications/Utilities.

    2. Enter an iprofiler command to collect data.

      例如,下面的命令执行5秒对你的应用程序的活动监视器跟踪和将结果保存在桌面上。单文件。For example, the following command performs an Activity Monitor trace on your app for 5 seconds and saves the results to the desktop in a .dtps file.

      • iprofiler -activitymonitor -T 5s -d ~/Desktop/
    3. Open Instruments, and choose File > Open.

      image: ../Art/instruments_fileopen_menu_2x.png
    4. Find your saved .dtps file, and click Open.

      image: ../Art/instruments_opendtpsfile_dialog_2x.png

      打开保存的文件后,仪器会自动添加相关的工具来跟踪文件和填充他们收集的数据。您可以查看和分析数据,以便找到应用程序中的任何问题。After opening the saved file, Instruments automatically adds the associated instruments to a trace document and populates them with the collected data. You can view and analyze the data in order to locate any issues with your app.

      image: ../Art/instruments_loadeddtps_file_2x.png

    iprofiler Options

    iprofiler provides the following set of configuration options for defining what data to collect.

     

    Configuration Option

    Description

    -l

    Provides a list of all supported instruments.

    -L

    Provides a list of all supported instruments and a description of what each template does.

    -legacy

    执行传统仪器的命令行界面在/usr/bin /仪器发现。Executes the legacy Instruments command-line interface found in /usr/bin/instruments.

    -T duration

    设置收集数据的时间长度。时间在秒(NS或N),毫秒(nm或NMS),或微秒(Nu或NUS)。默认值是10秒。Sets the length of time for which data is collected. Set duration in seconds (ns or n), milliseconds (nm or nms), or microseconds (nu or nus). The default is 10 seconds.

    -I interval

    设置在采样时间内进行测量的频率。间隔设置为秒(NS或N),毫秒(nm或NMS),或微秒(Nu或NUS)。默认是仪器应用程序默认的采样间隔。Sets the frequency with which a measurement is taken during the sample time. Set the interval to seconds (ns or n), milliseconds (nm or nms), or microseconds (nu or nus). The default is the Instruments app’s default sampling interval.

    -window period

    极限性能测试的最后阶段iprofiler运行。设置时间秒(NS或N),毫秒(nm或NMS),或微秒(Nu或NUS)。如果未指定此选项,则在整个运行期间测量性能。Limits the performance measurement to the final period of the iprofiler run. Set the period to seconds (ns or n), milliseconds (nm or nms), or microseconds (nu or nus). If this option is not specified, performance is measured throughout the entire run.

    Note: 这个选项可以用- timeprofiler和systemtrace模板选项仅用于。This option can be used only with the -timeprofiler and -systemtrace template options.

    -d path -o basename

    指定保存收集数据时使用的目标路径和名称。默认路径是当前工作目录。默认的是:是进程名称或进程ID。Specifies the destination path and the name used when saving the collected data. The default path is the current working directory. The default basename is the process name or process ID.

    -instrument name

    指定要运行的仪器。有效名称选项- activitymonitor,-分配-计数器- eventprofiler,泄漏,- systemtrace,和timeprofiler。Designates the instrument to be run. Valid name options are -activitymonitor-allocations, -counters-eventprofiler-leaks-systemtrace, and -timeprofiler.

    至少必须列出一个模板。你可以同时运行所有的七个模板。At least one template must be listed. You can run up to all seven templates at once.

    -kernelstacks

    指定内核栈只有堆叠。Designates kernel stacks only for backtraces.

    如果不kernelstacks不指定userandkernelstacks选项,包括用户栈回溯跟踪只。If neither -kernelstacks nor -userandkernelstacks options are specified, backtraces include user stacks only.

    -userandkernelstacks

    指定的回溯跟踪内核和用户栈。Designates both kernel and user stacks for backtraces.

    如果不kernelstacks不指定userandkernelstacks选项,包括用户栈回溯跟踪只。If neither -kernelstacks nor -userandkernelstacks options are specified, backtraces include user stacks only.

    -pmc PMC_MNEMONIC

    当与计数器一起使用时,指定事件的助记符。多记忆应该用逗号分隔。When used with -counters, specifies the mnemonic of the event to count. Multiple mnemonics should be comma-separated.

    -allthreadstates

    使时间分析器模板对所有线程进行配置。如果未指定此值,则时间分析器概要文件仅运行线程。Causes the Time Profiler template to profile all threads. If this value is not specified, Time Profiler profiles only running threads.

    -a process/pid

    连接到已经运行的进程。指定一个字符串附加该进程的名称以该字符串开头的进程。指定进程ID将其附加到与该进程ID相关联的进程。Attaches to a process that is already running. Specifying a string attaches the process whose name starts with that string. Specifying a process ID attaches it to the process associated with that process ID.

    泄漏选项要求您指定一个特定的单进程或进程ID。The -leaks option requires you to specify a specific single process or process ID.

    executable [args…]

    使目标进程在测量期间启动。列出可执行文件和参数,就像从命令行调用它们一样。Causes the target process to be launched for the duration of the measurement. Lists the executable and the arguments as if they are being invoked from the command line.

    iprofiler Examples

    一些常见的iprofiler命令行示例如下。A list of common iprofiler command-line examples are below.

    此示例使用时间分析器和活动监视工具收集当前工具中的当前采样持续时间集的所有正在运行的进程的数据。收集到的数据保存到工作目录为allprocs.dtps。This example collects data from all running processes for the current sampling duration set in Instruments using the Time Profiler and Activity Monitor instruments. The collected data is saved to the working directory as allprocs.dtps.

    1. iprofiler -timeprofiler -activitymonitor

    下面的示例打开和使用时间剖面仪应用收集数据。数据收集和数据是八秒,在/温度/ yourapp_perf.dtps保存。The following example opens and collects data from YourApp using the Time Profiler instrument. Data is collected for eight seconds, and the data is saved at /temp/YourApp_perf.dtps.

    1. iprofiler -T 8s -d /temp -o YourApp_perf -timeprofiler -a YourApp

    下面的示例使用泄漏和活动监视工具收集带有823进程ID的进程中的数据。数据收集为2500毫秒(2.5秒)和保存到工作目录yourapp_perf.dtps。The following example collects data from the process with the 823 process ID using the Leaks and Activity Monitor instruments. Data is collected for 2500 milliseconds (2.5 seconds) and is saved to the working directory as YourApp_perf.dtps.

    1. iprofiler -T 2500ms -o YourApp_perf -leaks -activitymonitor -a 823

    下面的示例打开和收集数据,从您的应用程序使用时间剖面和配置工具。数据收集的默认时间设置在仪器和保存在/tmp / allprocs.dtps。The following example opens and collects data from YourApp using the Time Profiler and Allocations instruments. Data is collected for the default amount of time set in Instruments and saved in /tmp/allprocs.dtps.

    1. iprofiler -d /tmp -timeprofiler -allocations -a YourApp.app

    下面的示例打开从YourApp在/路径/发现与使用时间剖面和系统跟踪仪器参数arg1收集数据。数据收集15秒,但只有在最后2秒收集的数据被保存。数据保存到工作目录yourapp_perf.dtps。The following example opens and collects data from YourApp found in /path/to with the argument arg1 using the Time Profiler and System Trace instruments. Data is collected for 15 seconds, but only the data collected in the last 2 seconds is saved. The data is saved to the working directory as YourApp_perf.dtps.

    1. iprofiler -T 15 -I 1000ms -window 2s -o YourApp_perf -timeprofiler -systemtrace /path/to/Your.app arg1

    减少仪器对数据收集的影响Minimize Instruments Impact on Data Collection

    仪器的设计是尽量减少对数据收集的影响。然而,通过更改一些基本设置,可以进一步减少影响工具对数据收集的影响。Instruments is designed to minimize its own impact on data collection. By changing some basic settings, however, you can further decrease the impact Instruments has on data collection.

    为了收集更多的数据,可以减少许多仪器的采样间隔。然而,短样本间隔导致的高采样率可能会导致一些问题:You can decrease the sample interval for many instruments in order to collect more data. However, high sample rates that result from a short sample interval can cause several problems:

    • 每个样品都需要处理器时间。高采样率使用更多的处理器时间。Processor time is required for every sample. High sample rates use more processor time.

    • 采样间隔时间可能不一致。中断用于启动每个示例。当使用非常小的采样间隔时,这些中断发生时的变化会导致采样率的显著变化。Sample interval timing may not be consistent. Interrupts are used to start each sample. Variations in when these interrupts occur can cause significant variations in the sample rate when using very small sample intervals.

    • 小样本间隔导致更多的样本被采取。每个样本都使用系统内存,大量的样本很快消耗掉内存较少的机器上的可用内存。Small sample intervals cause more samples to be taken. Each sample uses system memory, and a large number of samples quickly uses up the available memory on machines with less memory.

    以延迟模式运行仪器Run Instruments in Deferred Mode

    通过推迟数据分析直到您退出正在测试的应用程序,从而提高与性能相关的数据的准确性。通常情况下,仪器在应用程序运行时分析和显示数据,允许在收集数据时查看数据。执行分析实时通过占用CPU时间和内存来减慢目标进程,这将给您留下无法反映流程正常运行的测量结果。延迟模式下的运行工具会延迟数据分析,直到数据收集完成,要么在应用程序已经完成之后,要么在单击停止之后。在延迟模式下,您无法与收集数据的工具进行交互。Increase the accuracy of performance-related data by deferring data analysis until you quit the app you are testing. Typically, Instruments analyzes and displays data while your app runs, allowing you to view the data as it is collected. Performing analysis live slows down the target process by taking up CPU time and memory, which leaves you with measurements that may not reflect how the process would normally behave. Running Instruments in deferred mode delays the analysis of data until the data collection is done, either after your app has finished running or after you click Stop. While in deferred mode, you are blocked from interacting with the instruments that are collecting data.

    在延迟模式下,仪器完成采集数据后,仪器处理数据并将其显示在屏幕上。延迟数据分析将时间添加到数据收集过程的后期阶段,但它有助于确保与性能相关的数据是准确的。In deferred mode, after Instruments finishes collecting data, Instruments processes the data and displays it onscreen. Deferring data analysis adds time to the later stages of the data collection process, but it helps ensure that performance-related data is accurate.

    为仪器设置延迟模式To set deferred mode for Instruments
    1. Choose Instruments > Preferences.

      image: ../Art/instruments_preferences_menu_2x.png
    2. In the Recording pane, select the “Always use deferred mode” checkbox.

      image: ../Art/instruments_prefs_recording_deferred_option_2x.png

    对于特别长的跟踪,延迟模式引起的延迟可以是显著的。通过只需要非常精确的数据收集的跟踪设置延迟模式来避免这种延迟。For especially long traces, the delay caused by deferred mode can be significant. Avoid this delay by setting deferred mode for only those traces that require extremely precise data collection.

    设置跟踪的延迟模式To set deferred mode for a trace
    1. Choose File > Record Options.

      image: ../Art/instruments_recordoptions_menu_2x.png
    2. 在出现的对话框中,选择“延迟模式”复选框,然后单击“确定”。In the dialog that appears, select the Deferred Mode checkbox and then click OK.

      image: ../Art/instruments_recordoptions_dialog_deferred_option_2x.png

      如果仪表选项中启用了“总是使用延迟模式”,则禁用此选项。This option is disabled if “Always use deferred mode” is enabled in Instruments preferences.

  • 相关阅读:
    Asp.Net 之 前台绑定常用总结
    http无状态
    整理Py小demo
    RawURL
    整理的笔记
    单例模式
    DevExpress v18.1新版亮点——Analytics Dashboard篇(一)
    DevExpress v18.1新版亮点——Reporting篇(四)
    MyEclipse教程:使用UML创建模块库——第二部分(一)
    DevExpress v18.1新版亮点——Reporting篇(三)
  • 原文地址:https://www.cnblogs.com/zyingn/p/Record_Pause_and_Stop_Traces.html
Copyright © 2011-2022 走看看