Skip to content

Add hardware counter profile#3184

Open
bugRanger wants to merge 10 commits into
dotnet:masterfrom
bugRanger:feature/specific-hardware-counter
Open

Add hardware counter profile#3184
bugRanger wants to merge 10 commits into
dotnet:masterfrom
bugRanger:feature/specific-hardware-counter

Conversation

@bugRanger

@bugRanger bugRanger commented Jun 24, 2026

Copy link
Copy Markdown

SUMMARY

It's great that version 1 added counter support, but the expected counter names don't always match what the system provides.

Based on previous attempts (1, 2), providing free input strings provides versatility, but there are also drawbacks:

  • Inconvenient for teams working in different configurations;
  • Strings in attributes lead to a lot of duplicate code;

Therefore, an option with a profile description for extracting the required value sets could solve these problems.

UPD: Added simple test for ETW with custom profile, output result:

BenchmarkDotNet v0.16.0-develop (2026-06-25), Windows 10 (10.0.19045.6456/22H2/2022Update)
AMD Ryzen 7 5700G with Radeon Graphics 3.80GHz, 1 CPU, 16 logical and 8 physical cores
Memory: 27,9 GB Total, 13,77 GB Available
.NET SDK 10.0.103
  [Host] : .NET 8.0.24 (8.0.24, 8.0.2426.7010), X64 RyuJIT x86-64-v3
  Dry    : .NET 8.0.24 (8.0.24, 8.0.2426.7010), X64 RyuJIT x86-64-v3

Job=Dry  IterationCount=1  LaunchCount=1  
RunStrategy=ColdStart  UnrollFactor=1  

| Method         | Mean     | Error | FakeCacheMisses1/Op | FakeCacheMisses3/Op | FakeCacheMisses2/Op |
|--------------- |---------:|------:|--------------------:|--------------------:|--------------------:|
| SortedBranch   | 143.1 μs |    NA |             581,632 |             581,632 |              45,056 |
| UnsortedBranch | 180.3 μs |    NA |             577,536 |             577,536 |              45,056 |

@bugRanger

Copy link
Copy Markdown
Author

@dotnet-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant