1. Joseph Poirier
  2. cpu


cpu /

Filename Size Date modified Message
71 B
634 B
1.5 KB
942 B
2.3 KB
2.9 KB
4.3 KB
480 B
1.9 KB

    cpu package reports processor topology information

    Note that the term package refers to a physical processor
    and system refers to multiple packages. Also, a processor's
    hardware capability may differ from its configuration.

    See main.go for output information and usage

    make install  builds and installs the package

    make main  builds and installs the package and creates the example file main

- add error enumerations
- if 64-bit, or newer 32-bit, and the leaf value is less than 4 check IA32_MISC_ENABLES bit 22

- Package refers to a physical processor that plugs in to a socket
- Core refers to a physical sub-system of a package. A core may contain 1 or more
  logical processors
- A logical processor refers to a hardware resource that can execute a single thread
- Hyperthreading refers to the technology that allows a processor core to provide the
  functionality of more than one logical core
- Simultaneous Multi-Threading refers to multiple logical processors within the same core
- Multi-Core Processor contains more than one physical core
- MultiProcessor Platform contains multiple physical sockets
- Hardware Multithreading refers to any combination of hardware support to allow
  multithreading, which could be any combination of SMT, multi-core, and multi-processor
- Processor Topology is the hierarchical relationship of shared vs dedicated hadrware resources

I'm currently working on code to enumerate through packages/cores/threads.
I do development commits to the bitbucket repo but I'll be sure to make
incremental tags for working code.

At some point the package name will probably change to something broader
like sys with the information items containing more detail, e.g. sys.CpuCnt.

At this point the code has only been tested on 64-bit OS X.

For multi-package systems the package count calculation
probably isn't correct at the moment. It assumes that the
physical package count can be derived by dividing the maximum
processor count by the logical processor count of the package
that the thread is running on, and that the configuration is

The ideal way to calculate the package/core/thread count
for multi-package systems is to iterate through the system
by affinitizing the running thread, I'm working currently
working on.