Skip to content

Commit

Permalink
Improve HardwareCounters validation, see #1856
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyAkinshin committed Mar 8, 2023
1 parent 975a0e0 commit 6162e9d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/BenchmarkDotNet.Diagnostics.Windows/HardwareCounters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,14 @@ public static IEnumerable<ValidationError> Validate(ValidationParameters validat

foreach (var hardwareCounter in validationParameters.Config.GetHardwareCounters())
{
if (!EtwTranslations.TryGetValue(hardwareCounter, out var counterName))
yield return new ValidationError(true, $"Counter {hardwareCounter} not recognized. Please make sure that you are using counter available on your machine. You can get the list of available counters by running `tracelog.exe -profilesources Help`");
if (!EtwTranslations.TryGetValue(hardwareCounter, out string counterName))
{
yield return new ValidationError(true,
$"Counter {hardwareCounter} not recognized. " +
$"Please make sure that you are using counter available on your machine. " +
$"You can get the list of available counters by running `tracelog.exe -profilesources Help`");
continue;
}

if (!availableCpuCounters.ContainsKey(counterName))
yield return new ValidationError(true, $"The counter {counterName} is not available. Please make sure you are Windows 8+ without Hyper-V");
Expand Down

0 comments on commit 6162e9d

Please sign in to comment.