Skip to content

"Unknown processor" on Windows #2747

Closed
@alastairlundy

Description

@alastairlundy
Contributor

Hi,
When I run any Benchmark on my Laptop on Windows the Processor Model is not detected by BenchmarkDotNet.

BenchmarkDotNet v0.15.0, Windows 11 (10.0.26100.4061/24H2/2024Update/HudsonValley)
Unknown processor
.NET SDK 9.0.300
  [Host]   : .NET 8.0.16 (8.0.1625.21506), X64 RyuJIT AVX2
  .NET 9.0 : .NET 9.0.5 (9.0.525.21509), X64 RyuJIT AVX2

Job=.NET 9.0  Runtime=.NET 9.0

0.13.12 behaved the same when I used it before updating to 0.15.0 .

The processor is: 12th Gen Intel(R) Core(TM) i7-1270P

The Number of Cores is 12
The Number of Logical Processors is 16.

I saw in a previous bug report a wmic output was requested. I couldn't find wmic in the suggested file path: C:\Windows\System32\wbem and couldn't find any environment variable corresponding to wmic.

Thanks in advance.

Activity

AndreyAkinshin

AndreyAkinshin commented on Jun 4, 2025

@AndreyAkinshin
Member

@alastairlundy could you please run the below command in PowerShell and share if it prints the processor model?

Get-CimInstance Win32_Processor
alastairlundy

alastairlundy commented on Jun 4, 2025

@alastairlundy
ContributorAuthor

@alastairlundy could you please run the below command in PowerShell and share if it prints the processor model?

Get-CimInstance Win32_Processor

Thanks for the quick reply.

The output from that command is:

DeviceID Name                                Caption                               MaxClockSpeed SocketDesignation Manufacturer
-------- ----                                -------                               ------------- ----------------- ------------
CPU0     12th Gen Intel(R) Core(TM) i7-1270P Intel64 Family 6 Model 154 Stepping 3 2200          U3E1              GenuineIntel
AndreyAkinshin

AndreyAkinshin commented on Jun 4, 2025

@AndreyAkinshin
Member

BenchmarkDotNet has two strategies for detecting the CPU model on Windows (see WindowsCpuDetector): MosCpuDetector and WmicCpuDetector. If Wmic is not installed, MosCpuDetector is the only available detector. However, it is only enabled in .NET Framework, not in .NET Core/.NET 5+. Since Get-CimInstance Win32_Processor provides the expected CPU information, we have two possible solutions:

  • If ManagementObjectSearcher works on Windows with .NET 5+ (I currently do not have access to a Windows machine to verify this), we should update MosCpuDetector.IsApplicable.
  • Otherwise, we should call Get-CimInstance Win32_Processor via PowerShell, similar to how we call wmic.

PRs are welcome.

removed their assignment
on Jun 4, 2025
alastairlundy

alastairlundy commented on Jun 4, 2025

@alastairlundy
ContributorAuthor
  • If ManagementObjectSearcher works on Windows with .NET 5+ (I currently do not have access to a Windows machine to verify this), we should update MosCpuDetector.IsApplicable.

The .NET docs website entry for it says that it requires a dependency on this Nuget package for .NET Standard 2.0 and .NET 5+.

Figuring out how to add that dependency only on required TFMs (i.e. .NET 5+ and not .NET Framework) seems like it would be quite messy unless either a .NET Framework TFM was added to BenchmarkDotNet, or, if there's no objection, adding it as a dependency for all TFMs.

Edit: Actually it looks like version 6.0 of that package is already a dependency of BenchmarkDotNet so I don't see why the MosCpuDetector class couldn't be tweaked to run it on .NET 5+. Though it also may be worth updating that dependency to a newer version since the latest stable version is 9.0.5 .

Otherwise, we should call Get-CimInstance Win32_Processor via PowerShell, similar to how we call wmic.

If I were to work on a PR for this that calls Powershell, would you guys want the code to go into MosCpuDetector or a new Detector class?

@AndreyAkinshin Do you have a preference for either solution?

timcassell

timcassell commented on Jun 4, 2025

@timcassell
Collaborator

Though it also may be worth updating that dependency to a newer version since the latest stable version is 9.0.5 .

That would be best if it solves the issue.

alastairlundy

alastairlundy commented on Jun 4, 2025

@alastairlundy
ContributorAuthor

Unfortunately it looks like theSystem.Management package wrongly declares it works on .NET 5+ (See this and this) in that the code relies on a dll that isn't present if .NET Framework isn't installed on the target device.

In my fork I've enabled MosCpuDetector to run on .NET 5+ and tested it.

It works and the CPU is properly detected in BenchmarkDotNet sample benchmarks, but only because I also have .NET Framework installed. If I didn't have .NET Framework installed it would likely not work.

BenchmarkDotNet v0.15.1-develop (2025-06-04), Windows 11 (10.0.26100.4061/24H2/2024Update/HudsonValley)
12th Gen Intel Core i7-1270P 2.20GHz, 1 CPU, 16 logical and 12 physical cores
.NET SDK 9.0.300
  [Host]     : .NET 8.0.16 (8.0.1625.21506), X64 RyuJIT AVX2 [AttachedDebugger]
  DefaultJob : .NET 8.0.16 (8.0.1625.21506), X64 RyuJIT AVX2

I think MosCpuDetector should stay disabled on .NET 5+, and use a detector that works on .NET 5+ on Windows without WMIC and without .NET Framework once that is available.

I'll give the Powershell based detector a shot.

timcassell

timcassell commented on Jun 4, 2025

@timcassell
Collaborator

.Net Framework comes installed on Windows standard. I don't think we need to support the fringe case of Windows without Framework. Framework has no end support date.

timcassell

timcassell commented on Jun 4, 2025

@timcassell
Collaborator

dotnet/runtime#66386 (comment) Suggests to use WMILight instead of System.Management, which you could try.

added this to the v0.15.3 milestone on Jun 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

    Development

    Participants

    @AndreyAkinshin@timcassell@alastairlundy

    Issue actions

      "Unknown processor" on Windows · Issue #2747 · dotnet/BenchmarkDotNet