Skip to content

Instantly share code, notes, and snippets.

@matru
Created October 1, 2025 21:47
Show Gist options
  • Select an option

  • Save matru/3da996fd21d1c0bb03369a86ff5c25fc to your computer and use it in GitHub Desktop.

Select an option

Save matru/3da996fd21d1c0bb03369a86ff5c25fc to your computer and use it in GitHub Desktop.
Extract ISR/DPC execution time data with xperf
@echo off
REM --- Check for admin privileges ---
net session >nul 2>&1
if %errorlevel% neq 0 (
echo error: administrator privileges required >&2
exit /b 1
)
REM --- Check for xperf ---
where xperf.exe > nul 2>&1
if not %errorlevel% == 0 (
echo error: xperf not found in path. Install "Windows Performance Toolkit" in the ADK from the link below >&2
echo https://learn.microsoft.com/en-us/windows-hardware/get-started/adk-install
exit /b 1
)
set "record_delay=3"
set "record_duration=10"
set "etl_file=%TEMP%\kernel.etl"
set "report_file=%TEMP%\report.txt"
echo starting in %record_delay%s
timeout /t %record_delay% /nobreak
echo recording for %record_duration%s
xperf -on PROC_THREAD+LOADER+INTERRUPT+DPC
timeout /t %record_duration% /nobreak
xperf -stop
xperf -d "%etl_file%"
xperf -i "%etl_file%" -o "%report_file%" -a dpcisr
echo report saved in %report_file%
exit /b 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment