MCPcopy Index your code
hub / github.com/SwiftyPop/TimerResBenchmark

github.com/SwiftyPop/TimerResBenchmark @v0.30

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.30 ↗ · + Follow
8 symbols 14 edges 1 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

TimerResBenchmark

A Rust-based tool for benchmarking system timer resolution to achieve precise sleep intervals, optimizing performance and consistency for high-performance tasks like gaming, especially in low-latency scenarios. It automatically detects HPET status and identifies the optimal timer resolution for your system.

image


Features

  • Checks if HPET is enabled or disabled during benchmark setup. image
  • Customizable Benchmark Parameters
  • Modify the start value, end value, increment value and sample value through the program/config file. timer_res_benchmark_xUHblQxThy

  • Automatically detects the optimal timer resolution for your system based on the lowest sleep delta and standard deviation. image

  • Rewritten in Rust for better performance and less overhead.


Installation and Usage

  1. Disable HPET and set up an Idle-disabled power plan (follow the Troubleshooting guide for help).
  2. Download the latest release from GitHub Releases.
  3. Extract the .7z archive.
  4. Run timer_res_benchmark.exe as an administrator.
  5. You can adjust the benchmark parameters directly in the program or modify them manually in the 'appsettings.json' file(default value).
  6. After the benchmark completes, it will automatically detect the optimal timer resolution for your system. The results and additional details will be saved in the 'results.txt' file.

Step 2: Set the Optimal Timer Resolution

  1. Create a shortcut for SetTimerResolution.exe.
  2. Place the shortcut in your shell:startup folder with the following target:
C:\PATH\TO\SetTimerResolution.exe --no-console --resolution 5000
  • Replace 5000 with your optimal resolution (e.g., 5000 for 0.5ms).
  • Restart your PC and verify the settings using MeasureSleep.exe.

[Optional] Visualize the Results

  1. Visit Plotly Chart Studio.
  2. Click "Import" at the top right and upload the results.txt file.
  3. Add a trace and configure the settings as shown below: Plotly Configuration
  4. Look for the lowest Sleep(1) Delta on the y-axis. This represents the most precise and consistent 1ms sleep delays.
  5. Example: If the lowest delta is at 0.5024ms, this is your optimal timer resolution.

Troubleshooting

Sleep Delays Are Spiking (>1ms)

  1. Disable HPET:
  2. Open Command Prompt as administrator and run: bash bcdedit /deletevalue useplatformclock bcdedit /set disabledynamictick yes
  3. On Windows Server 2022+ and Windows 11+, apply this registry change: plaintext [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel] "GlobalTimerResolutionRequests"=dword:00000001
  4. You can now verify HPET status via this program: image

  5. Use an Idle-Disabled Power Plan:

  6. Download the Muren power plan.
  7. Import the plan using Command Prompt: bash powercfg -import C:\PATH\TO\MUREN.POW
  8. Set your power plan to Muren.

Why Use TimerResBenchmark?

  • Disables HPET and uses more stable timers (e.g., TSC at 3.32MHz) for better frame rate consistency and lower latency.
  • Unlike the original PowerShell-based benchmark, this tool is now a native executable written in Rust, making it faster and easier to use.
  • This tool was initially rewritten from C# to Rust as part of a learning project. Contributions and feedback are always welcome!

License

This project is licensed under the MIT License. See the LICENSE file for details.

Core symbols most depended-on inside this repo

prompt_user
called by 1
src/main.rs
prompt_exit
called by 1
src/main.rs
check_hpet_status
called by 1
src/main.rs
parse_measurement_output
called by 1
src/main.rs
is_admin
called by 1
src/main.rs
kill_process
called by 1
src/main.rs
main
called by 0
src/main.rs

Shape

Function 7
Class 1

Languages

Rust100%

Modules by API surface

src/main.rs8 symbols

For agents

$ claude mcp add TimerResBenchmark \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact