Report a bug
If you spot a problem with this page, click here to create a Github issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

cpuid.unified

High level abstraction on top of all architectures.

This module is compatible with betterC compilation mode.
Authors:
Ilya Yaroshenko
Examples:
void smallReport()
{
    import std.stdio;
    import cpuid.unified;

    cpuid_init();

    enum fmt = "%14s: %s";

    fmt.writefln("cores", cores);
    fmt.writefln("threads", threads);

    fmt.writefln("data caches", dCache.length);
    fmt.writefln("code caches", iCache.length);
    fmt.writefln("unified caches", uCache.length);

    fmt.writefln("data TLBs", dTlb.length);
    fmt.writefln("code TLBs", iTlb.length);
    fmt.writefln("unified TLBs", uTlb.length);
}
export nothrow @nogc void cpuid_init();
Initialize basic CPU information including basic architecture. It is safe to call this function multiple times. It calls appropriate basic initialization for each module (cpuid_x86_any_init for X86 machines).
export nothrow @nogc @trusted uint cpuid_cpus();

export alias cpus = cpuid_cpus;
Total number of CPU packages.

Note: not implemented

export nothrow @nogc @trusted uint cpuid_cores();

export alias cores = cpuid_cores;
Total number of cores per CPU.
export nothrow @nogc @trusted uint cpuid_threads();

export alias threads = cpuid_threads;
Total number of threads per CPU.
export nothrow @nogc @trusted const(Cache)[] cpuid_dCache();

export alias dCache = cpuid_dCache;
Data Caches
Returns:
Array composed of detected data caches. Array is sorted in ascending order.
export nothrow @nogc @trusted const(Cache)[] cpuid_iCache();

export alias iCache = cpuid_iCache;
Instruction Caches
Returns:
Array composed of detected instruction caches. Array is sorted in ascending order.
export nothrow @nogc @trusted const(Cache)[] cpuid_uCache();

export alias uCache = cpuid_uCache;
Unified Caches
Returns:
Array composed of detected unified caches. Array is sorted in ascending order.
export nothrow @nogc @trusted const(Tlb)[] cpuid_dTlb();

export alias dTlb = cpuid_dTlb;
Data Translation Lookaside Buffers
Returns:
Array composed of detected data translation lookaside buffers. Array is sorted in ascending order.
export nothrow @nogc @trusted const(Tlb)[] cpuid_iTlb();

export alias iTlb = cpuid_iTlb;
Instruction Translation Lookaside Buffers
Returns:
Array composed of detected instruction translation lookaside buffers. Array is sorted in ascending order.
export nothrow @nogc @trusted const(Tlb)[] cpuid_uTlb();

export alias uTlb = cpuid_uTlb;
Unified Translation Lookaside Buffers
Returns:
Array composed of detected unified translation lookaside buffers. Array is sorted in ascending order.