LibreHardwareMonitor / LibreHardwareMonitor/LibreHardwareMonitor

Core Count is wrong...

Open
#1,228 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
9.1k
Forks
1k
Avg merge
1d 4h
Merged PRs (30d)
15

Description

I have a CPU with SMT, 8 Cores / 16 Threads.

LibreHardwareMonitor reports it as 16 Cores under CPU but 8 Cores in the SMBIOS Part, so clearly something is being processed wrong.

While taking a deep dive into your Code I've found something that would Explain this behavior:

public GenericCpu(int processorIndex, CpuId[][] cpuId, ISettings settings) : base(cpuId[0][0].Name, CreateIdentifier(cpuId[0][0].Vendor, processorIndex), settings)
    {
...
        _coreCount = cpuId.Length;
        _threadCount = cpuId.Sum(x => x.Length);

So due to the fact that the CpuId Array contains one element per thread and it's length is used for both fields, you will always get a wrong count for the core count for processors with SMT/ HyperThreading.

To solve this issue you could divide the thread count by two. This will be more reliable than using the SMBIOS Data, because the user could've disabled some cores, which may not be reflected within the SMBIOS Data.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the GenericCpu constructor shown in the issue and trace how the CpuId array is built for SMT processors. Verify the reported core and thread counts against the 8-core/16-thread case, then confirm that the CPU view and SMBIOS part no longer disagree for that case.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.