:orphan: .. **************************************************************************** .. CUI .. .. The Advanced Framework for Simulation, Integration, and Modeling (AFSIM) .. .. Copyright (C) 2021 Stellar Science; U.S. Government has Unlimited Rights. .. .. The use, dissemination or disclosure of data in this file is subject to .. limitation or restriction. See accompanying README and LICENSE for details. .. **************************************************************************** Performance Tools ================= .. contents:: Contents :backlinks: none :local: What are WPR/WPA? ----------------- Windows Performance Recorder (WPR) and Windows Performance Analyzer (WPA) are performance monitoring tools found in the `Windows Performance Toolkit `_. They are free tools that can be obtained by downloading and installing the Windows Assessment and Deployment Kit (ADK). WPR is a tool that allows users to dynamically deploy the Event Tracing for Windows (ETW) infrastructure which enables the capture of kernel and application events. WPR acts as a session controller, allowing the user to start and stop event tracing on all running applications, and collect metrics to diagnose performance issues. .. figure:: ../images/wpr.png :align: center :scale: 50 % WPA is a tool that allows the user to visualize the event trace log (ETL) files generated by WPR, and perform analysis on the recorded applications. .. important:: The user requires access to the corresponding symbols (PDB) of the application that is being profiled, as they are necessary for WPA to identify the function a process is in. PDB files are not shipped with AFSIM releases, but they can be generated if the source code is accessible. .. figure:: ../images/wpa.png :align: center :scale: 50 % How to install WPR/WPA ---------------------- If Windows ADK is not installed on the testing machine, it can be obtained by going to the `download `_ page and selecting the proper installer for the version of Windows being used. The following are the system requirements for running Windows Performance Toolkit: - WPR : Windows 8 or later. - WPA : Windows 8 or later with the Microsoft .NET Framework 4.5 or later. When running the install executable, the user should disable sending anonymous messages and select Windows Performance Toolkit, which contains WPR and WPA. .. note:: Windows Performance Toolkit provides support for the previous command line tool, Xperf. However, Xperfview is no longer supported and all recordings using Xperf must be opened and analyzed by using WPA. .. figure:: ../images/adk_setup1.png :align: center :scale: 50 % Once the installation is finished, the performance tools will be ready to begin performance testing. How to use WPR -------------- The WPR UI can be launched by typing "Windows Performance Recorder" into the taskbar search field or by finding it under Windows Kits when clicking the Start button. Before starting a recording session, the user must configure WPR. The following are recommended settings: 1. Set **Performance Scenario** to *General* - This sets WPR for general purpose recording while the computer is running. 2. Set **Detail Level** to *Verbose* - *Light* carries less overhead and interferes less with the systems; however, verbose recordings are more useful for thorough analysis. 3. Set **Logging** - Select *File* for short and targeted profiling sessions. This will record data into sequential files which will indefinitely grow, so a short session is recommended to avoid generating unnecessarily large files. - Select *Memory* for indeterminant profiling sessions; that is, the user can keep the recorder running until they detect something note-worthy or reach the exact point in the application they want to profile (i.e., launching *Mission* through the *Wizard* UI after loading a script). This will record data into a cyclical buffer that begins to drop the oldest events when the data size exceeds the buffer size. .. warning:: *File* mode can lead to recordings that are too big for WPA to open if the session runs for too long. 4. Select the **profiles** - *CPU Usage* - *Heap Usage* and *VirtualAlloc Usage* for memory profile A more detailed description of the WPR features can be found in the `WPR documentation `_ page. Once WPR is configured, the user can click on *Start* to begin the recording session which will capture **everything** that is running on the CPU. At this point, the user can run the application that needs to be profiled (*Wizard*, *Mission*, etc.). Clicking *Save* will stop the session and save the profile data; this will generate the event trace log. WPR can also be run in the command prompt. The performance tools require elevated privileges for use, so the user must run the command prompt as an **Administrator**. Here is a sample command to begin profiling: ``wpr -start CPU.Verbose -recordtempto C:\\wpr_test_temp`` This example command specifies that CPU usage will be recorded, and that the desired detail level will be set to *Verbose*. A temporary directory must also be specified, for which WPR will use to store intermediate files when generating the resulting ETL. To stop WPR and save the recording, use the command ``wpr -stop C:\\test.etl "Description of problem" -skipPdbGen`` The path and file name must be specified, as does a description for the report. The *skipPdbGen* flag tells WPR not to generate any cached symbols files. For more information on how to use WPR via command line, the user can use the command ``wpr -help