Add hardware counter profile#3184
Conversation
|
@dotnet-policy-service agree |
|
It's an interesting approach. But it looks like you can only remap existing |
| @@ -0,0 +1,50 @@ | |||
| <Project Sdk="Microsoft.NET.Sdk"> | |||
There was a problem hiding this comment.
If this project is not expected to be executed on CI.
Is it able to define these tests on BenchmarkDotNet.IntegrationTests.ManualRunning project side?
|
|
||
| public class HardwareCounterTests(ITestOutputHelper output) : BenchmarkTestExecutor(output) | ||
| { | ||
| [Fact] |
There was a problem hiding this comment.
This test has ETW namespace.
Is this test works on non-Windows environment?
There was a problem hiding this comment.
I would not expect it to.
In that case, I think it need to replace [Fact] to use [EnvSpecificFact(EnvRequirement.WindowsOnly)].
This is a good question! 👍 I welcome any criticism, as even now I feel like my solution doesn't fully address or reflect the problem. A little context As far as I understand, ProfileSources includes a set of counters familiar to Windows and excludes many vendor-specific counters. But, apparently, these counters aren't ignored, but rather somehow registered by the system and made available in ETW. However, it is worth noting that all the approaches described above understand the configuration on which they are running, while our performance testing script is described by a set of attributes or a launch configuration and does not know what system it will run on. Results In my solution, the old version of HardwareCounter (which mapped directly to the counter name) is used as an abstraction when connecting the counter. This provides an advantage when setting up a benchmark scenario, as you don't need to specify which processor models the code should run on, but it does require the executor to load a profile that will implement the necessary performance counter mapping. However, I wouldn't remove the old version, which attempts to directly map HardwareCounter to the required counters. I think it could be improved by allowing it to determine which counters it can use from the available enumeration for a given machine at the time the benchmark is launched (use table ProfileSources). P.S. |
|
Planned list of changes:
|
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:
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: