# Sample Instructions with WindowsPerf and Arm SPE

## In this learning path

- [Introduction](https://learn.arm.com/learning-paths/cross-platform/windowsperf_sampling_cpython_spe/)
- [Overview of Arm Statistical Profiling Extension](https://learn.arm.com/learning-paths/cross-platform/windowsperf_sampling_cpython_spe/overview/)
- [Setup](https://learn.arm.com/learning-paths/cross-platform/windowsperf_sampling_cpython_spe/windowsperf_sampling_cpython_spe/)
- [WindowsPerf Sample using SPE](https://learn.arm.com/learning-paths/cross-platform/windowsperf_sampling_cpython_spe/windowsperf_sampling_cpython_spe_example_1/)
- [WindowsPerf Record using SPE](https://learn.arm.com/learning-paths/cross-platform/windowsperf_sampling_cpython_spe/windowsperf_sampling_cpython_spe_example_2/)
- [Summary](https://learn.arm.com/learning-paths/cross-platform/windowsperf_sampling_cpython_spe/summary/)
- [Next Steps](https://learn.arm.com/learning-paths/cross-platform/windowsperf_sampling_cpython_spe/_next-steps/)

## About this Learning Path

|  |  |
| --- | --- |
| Skill level: | Introductory |
| Reading time: | 30 min |
| Last updated: | 05 Aug 2026 |

|  |  |
| --- | --- |
| Author: | Przemyslaw Wirkus , Arm<br>[GitHub](https://github.com/PrzemekWirkus)<br>[LinkedIn](https://linkedin.com/in/przemyslaw-wirkus-78b73352) |
| Arm IP: | [Neoverse](https://support.arm.com/?tab=compute-ip&Product%20Type=Infrastructure%20Processors) [Cortex-A](https://support.arm.com/?tab=compute-ip&Product%20Type=Application%20Processors) |
| Tags: | [Performance and Architecture](https://learn.arm.com/tag/performance-and-architecture) [Windows](https://learn.arm.com/tag/windows) [WindowsPerf](https://learn.arm.com/tag/windowsperf) [Python](https://learn.arm.com/tag/python) [perf](https://learn.arm.com/tag/perf) |

### Who is this for?
This is an introductory topic for developers who would like to learn about sampling CPU instructions with WindowsPerf and the Arm Statistical Profiling Extension (SPE).

### What will you learn?
After completing this Learning Path, you'll be able to perform the following tasks:
- Use WindowsPerf with a native Windows on Arm workload.
- Describe the basic concepts of sampling with Arm SPE.
- Explore the WindowsPerf command line.
- Build CPython from sources for Windows on Arm (AArch64).

### Prerequisites
Before starting, you'll need the following prerequisites:
- A Windows on Arm desktop or development machine, with CPU support for SPE.
- An installation of [WindowsPerf](https://learn.arm.com/install-guides/wperf/).
- An installation of [Visual Studio](https://learn.arm.com/install-guides/vs-woa/).
- An installation of [Git](https://learn.arm.com/install-guides/git-woa/).

### Summary
You’ll use WindowsPerf and the Arm SPE to sample CPU instructions on Windows on Arm. First, you’ll check SPE support in the CPU and WindowsPerf binaries, build a debug CPython for AArch64, and run a compute-heavy expression. Then, you’ll use `wperf sample` and `wperf record` to start the workload and capture samples. Finally, you’ll review the results with source annotation and disassembly.

### Frequently asked questions

**Which WindowsPerf build should I use to profile with Arm SPE?**

Use the SPE-enabled build included in WindowsPerf release `3.8.0`. Download the release asset and select the WindowsPerf build in the `SPE/` subdirectory.

**Do I need a debug build of CPython for this path?**

Yes. The examples use `python_d.exe`, which you build from CPython sources in debug mode for Windows on Arm (AArch64).

**How do I pass Python arguments without wperf parsing them?**

Use `--` to separate `wperf` options from the arguments passed to `python_d.exe`. Everything after `--` is forwarded to the Python process.

**Why pin the CPython process to one CPU core, and which core is used?**

Pinning keeps the workload on a known CPU so collected samples map to that core consistently. Pin the process to core 1.

**What result should I expect after running wperf record with an SPE event?**

WindowsPerf records SPE load events for the run. Use the `--annotate` and `--disassemble` options to review where sampled instructions map to source code and assembly.
