We are excited to introduce version 2.1.0 of the WindowsPerf Visual Studio Extension, now available on the Visual Studio Marketplace. This update brings several new features aimed at enhancing performance profiling on Windows on Arm devices. The extension is fully compatible with WindowsPerf version 3.7.2, a tool inspired by Linux Perf but optimized for Windows on Arm systems.

How to install WindowsPerf GUI extension?

You can easily install the tool directly from the Visual Studio Marketplace or through the Visual Studio IDE by navigating to "Extensions > Manage Extensions…" and searching for "WindowsPerf GUI."

Note: To install WindowsPerf 3.7.2 on your Windows on Arm system follow steps described here.

Why WindowsPerf GUI?

While the command line interface of WindowsPerf is powerful, it can be intimidating for many users. The WindowsPerf GUI was designed to offer a more intuitive, user-friendly experience, enabling developers to adjust settings, run profiling, and visualize results directly within Visual Studio.

Key Features in This Release

1. WindowsPerf WPA-Plugin

What is Windows Performance Analyzer

Windows Performance Analyzer (WPA) is a tool designed to create detailed graphs and data tables from Event Tracing for Windows (ETW) events. WPA can process any event trace log (ETL) file for in-depth analysis.

WPA capabilities can be expanded upon using the Microsoft Performance Toolkit SDK by creating plugins which enable parsing any type of data (WindowsPerf JSON output in our case).

WPA-plugin functionality

  • In order to visualize the output of WindowsPerf, WPA-plugin bridges the gap between the detailed output of WindowsPerf and the powerful visualization capabilities of WPA.
  • The plugin is built on the Microsoft Performance Toolkit SDK and is shipped as a single Dynamic Link Library (DLL) file that can be downloaded from the release page.
  • WPA can be launched from within Visual Studio thanks to our extension. A button is shown after a successful count is executed and opens the results in a new WPA window.
  • Installation details and further reading are available on the WPA Plugin Wiki.

Example WindowsPerf counting data imported to WPA via WPA-plugin.

2. New Counting Model

What is the counting model

The counting model provides an overall performance statistic for a program. This model can be attached to a currently running process, initiated with a new process, or even set to monitor the entire system. It returns an aggregated count of selected events, event groups, and metrics. This model is implemented in WindowsPerf user space through the command  "wperf stat" and using the "--json" flag it returns the data in a JSON format that can be exploited by the extension.

The counting model in the extension

The latest update integrates a "wperf stat" command builder within the GUI.

  • This allows users to easily choose CPU cores, optional target payloads, metrics, and events.
  • Users can also group events to create counting event groups.
  • Counting results can be previewed within the Visual Studio IDE or analyzed more thoroughly in Windows Performance Analyzer (WPA) - this requires WindowsPerf WPA-plugin installation.
  • WPA-plugin can import WindowsPerf JSON output (from counting, e.g. timeline output) to WPA for further analysis.

For more information, check out our Counting Settings Tutorial.

Example of WindowsPerf GUI Counting Settings

WindowsPerf GUI Counting Settings window with example counting results and launched WPA-plugin in WPA.

3. Lock-Unlock feature

One of the critical aspects of performance profiling is ensuring that the data collected is accurate and free from interference. When WindowsPerf communicates with its Kernel Driver, the driver automatically acquires a lock, preventing other instances of WindowsPerf from accessing the driver and its resources. This locking mechanism is essential for protecting the integrity of the current WindowsPerf execution, ensuring that no other processes can interfere with the ongoing profiling session.

However, this also means that if another WindowsPerf process has locked the driver, any new attempts to use WindowsPerf will be blocked, and users will receive an error message indicating that access has been denied:

"warning: other WindowsPerf process acquired the WindowsPerf-driver. Operation canceled!"

In order to force the release of the lock, a new --force-lock command argument was introduced to both WindowsPerf and the extension that lets you interrupt the ongoing WindowsPerf process and take over the lock.

However, interrupting a running `wperf` process would result in losing all the collected data. If interrupted, WidowsPerf will show the following error message:

"warning: other WindowsPerf process hijacked (forced lock) the wperf-driver, see --force-lock. Operation terminated, your data was lost!"

"Received ERROR_BAD_COMMAND, driver status:

STATUS_INVALID_DEVICE_STATE

error: PMU_CTL_LOCK_RELEASE can't be release"

4. Disassembly Support in Sampling

The addition of disassembly support in the WindowsPerf extension represents a significant enhancement for developers who require deep insights into performance bottlenecks within their code. Disassembly support allows users to examine the specific instructions executed by the CPU, providing a detailed view of performance hotspots at the instruction level. This level of analysis is crucial for optimizing code, as it enables developers to identify the exact points in their codebase where performance issues arise.

  • Added disassembly output from sampling runs to the Sampling Explorer widget, providing users with the opportunity to dive deeper into the most frequently executed instructions.
  • Enhanced the editor by adding line highlighting to better identify hotspots directly in the codebase.
  • Improved the percentage display in the Sampling Explorer table

Explore how to leverage this powerful feature in our Sampling Explorer Tutorial.

Example Extension Sample Settings Window with sampling output in Visual Studio IDE

UX Improvements

A new "Build and Run" button has been added to the extension, providing a seamless way to ensure that all performance tests are conducted on the latest version of your code. This feature simplifies the testing process, reducing the risk of analyzing outdated code and ensuring that performance profiling always reflects the most current state of the project.

Several user experience improvements have been implemented to make the extension more intuitive and user-friendly. These include a case-insensitive event search feature, which allows users to find events more easily regardless of the case used in their search terms. Additionally, tooltips have been added to certain icon buttons, providing users with helpful information when they hover over these elements. These enhancements are designed to streamline the user experience, making it easier for developers to navigate the extension and access the features they need.

Looking Ahead

We're committed to continuously improving the WindowsPerf Visual Studio Extension. Future updates will include alignment with the latest WindowsPerf releases, better support for telemetry solutions, and enhanced lock/unlock functionality. Stay tuned for more!

Open Source

The extension is open sourced and freely available under the BSD license.

Saemie Chouchane

Saemie is the Chief Technology Officer (CTO) at Day Devs, with a background in application development and software engineering since 2010. Passionate about the latest advancements in artificial intelligence, he is dedicated to finding where AI truly excels. His main focus is the chip industry, and he is excited about its future innovations and possibilities.

See All Works