WPR - CMD


Overview

WPR (Windows Performance Recorder) is a command-line utility part of the Windows Performance Toolkit (WPT) that enables users to collect detailed performance data about their Windows operating system and applications. It’s primarily used for diagnosing system performance issues, analyzing application behavior, and identifying bottlenecks. WPR is effective in environments where performance tuning and troubleshooting are regularly needed, such as development, testing, and production systems.

Syntax

The basic syntax of the WPR command is:

wpr [options] [profiles]
  • options – These control how WPR operates and modifies its default behavior.
  • profiles – Optional. Specifies one or more performance recording profiles.

Here are various ways to use the command:

wpr -start <Profile>
wpr -stop <OutputFile>
wpr -cancel

Options/Flags

  • -start – Starts recording using specified profiles. If no profile is provided, a default is used.
  • -stop – Stops the current recording and saves the data to the specified output file.
  • -cancel – Cancels an ongoing recording without saving the data.
  • -boot – Configures boot-time profile recording.
  • -delay – Used with -boot to delay recording start by the specified number of seconds.
  • -filemode – Sets recording to file mode, which directly writes data to a file rather than using memory.
  • -um – Initiates user-mode recording on specified events.
  • -pm – Initiates kernel-mode recording.
  • -status – Displays the status of ongoing recording.

Examples

  1. Start Basic Recording:

    wpr -start GeneralProfile
    

    Begins recording using the GeneralProfile.

  2. Stop and Save Recording:

    wpr -stop MyOutput.etl
    

    Stops the recording and saves the data to MyOutput.etl.

  3. Boot-Time Recording:

    wpr -boot -start CPU
    

    Configures and starts CPU-specific data collection at boot.

  4. Cancel Ongoing Recording:

    wpr -cancel
    

    Cancels the currently active recording session.

Common Issues

  • Permission Errors: Ensure you run WPR with administrative privileges to avoid access-related errors.
  • Disk Space Issues: Recording, especially in file mode, can consume substantial disk space. Monitor disk usage to prevent space exhaustion.
  • Incorrect Flags Combination: Some options cannot be used together. Refer to the official documentation to ensure compatibility between flags.

Integration

WPR can be combined with wpa.exe (Windows Performance Analyzer) for an in-depth analysis of the recorded data. For instance, records collected by WPR can be opened in WPA for graphical analysis:

wpr -start CPU
# Wait for some time
wpr -stop result.etl
wpa result.etl

This sequence provides a streamlined workflow from data collection to analysis.

  • Xperf: Older command-line tool for performance monitoring, replaced by WPR.
  • WPA: Analyze performance data collected by WPR.

For in-depth learning and latest information, refer to the Microsoft’s official documentation.

The use of WPR coupled with other tools in the Windows Performance Toolkit can provide robust solutions for performance diagnostics and troubleshooting across a variety of Windows environments.