Skip to content
This repository was archived by the owner on Nov 3, 2025. It is now read-only.
This repository was archived by the owner on Nov 3, 2025. It is now read-only.

How to check the status of hyper threading? #3

@ChenZhongPu

Description

@ChenZhongPu

Currently, the code to check whether the hyper threading is on:

if (total_cores * total_physical_cpus) * 2 == total_logical_cpus:
    hyperthreading = True

But it seems that the code above is not correct, because it can be partially on. For example, the results in my desktop:

❯ python3 check.py
  This system has 1 physical CPUs
  This system has 16 cores per physical CPU
  This system has 16 total cores
  This system has 24 logical CPUs

Why not compare tocal cores to logical CPUs directly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions