cpu /

Filename Size Date modified Message
71 B
360 B
1.5 KB
918 B
3.4 KB
4.1 KB
3.9 KB
480 B
1.5 KB
Description
------------

    cpu package reports processor topology

    currently reports (see main.go):
        - if an error was encountered which would invalidate info
        - if the cpuid instruction is present/executable, older 486 or below - always 1 core per package
        - if cpuid execution is restricted, unable to execute cpuid functions
        - if Hyper-Threading Technology is supported, but doesn't necessarily mean it's enabled
        - maximum number of processors supported by the OS
        - number of processors on line
        - Vendor name
        - report total package count
        - report total core count
        - report total thread count
        - report HTT per core count
        - report HTT per package count

    TODO
    ----
    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
    symmetrical.

    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.

    A lot of this information can be derived on nix systems
    (linux?) using sysctl, examples:
        hw.ncpu
        hw.physicalcpu
        hw.physicalcpu_max
        hw.logicalcpu
        hw.logicalcpu_max
        machdep.cpu.logical_per_package
        machdep.cpu.cores_per_package
        machdep.cpu.core_count
        machdep.cpu.thread_count

    You ccould do this from a bash script or make or call to sysctl
    from within some Go code

Compiling
---------
    make install - builds and installs the package

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

Usage
-----
    see main.go

Examples
--------
    see main.go

Misc
----
- 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

TODO
----
- add error enumerations
- handle non-windows systems that don't have _SC_NPROCESSORS_ONLN and _SC_NPROCESSORS_CONF
- if 64-bit, or newer 32-bit, and the leaf value is less than 4 check IA32_MISC_ENABLES bit 22
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.