Enable User-Mode Hardware Performance Counters

Hardware Performance Monitoring Counters (PMCs) allow developers and performance profiling tools to measure low-level CPU events such as cache misses, branch mispredictions, and instruction cycles. By default, Windows restricts access to these CPU performance counters to kernel-mode drivers and elevated administrators for security reasons. This guide explains how to enable user-mode access to hardware performance monitoring counters directly through the Windows Registry Editor (Regedit).

Step-by-Step Guide to Enable User-Mode PMC Access

Follow these instructions to configure the Windows Registry to allow user-mode applications to read CPU performance counters:

Step 1: Open the Registry Editor

  1. Press Windows Key + R to open the Run dialog box.
  2. Type regedit and press Enter or click OK.
  3. If prompted by User Account Control (UAC), click Yes to grant administrative permissions.

Step 2: Navigate to the Session Manager Kernel Key

In the Registry Editor address bar, paste or browse to the following path:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Kernel

Step 3: Create or Modify the DWORD Value

  1. Check the right-hand pane for a value named AllowUserModeProfiling.
  2. If it does not exist:
    • Right-click an empty area in the right pane.
    • Select New > DWORD (32-bit) Value.
    • Name the new value AllowUserModeProfiling.
  3. Double-click AllowUserModeProfiling.
  4. Set the Value data to 1.
  5. Ensure the Base is set to Hexadecimal (or Decimal, as 1 is identical in both).
  6. Click OK to save changes.

Step 4: Restart the System

Registry modifications that affect kernel-level hardware counter policies do not take effect immediately. Restart your computer to apply the new settings.


Verifying User-Mode Access

After rebooting, profiling software such as Intel VTune, AMD μProf, or the Windows Performance Toolkit can access CPU Performance Monitoring Units (PMUs) directly from standard user-level processes without requiring elevated administrator privileges.

If you need to revert the changes at any point: 1. Reopen regedit and navigate back to the same key. 2. Change the AllowUserModeProfiling value data back to 0, or right-click and Delete the entry. 3. Restart your computer.