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 cpuid.unified;

    import std.stdio: writefln;
    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 mir_cpuid_init();

export alias cpuid_init = mir_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 pure nothrow @nogc @trusted uint mir_cpuid_cpus();

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

Note not implemented

export pure nothrow @nogc @trusted uint mir_cpuid_cores();

export alias cores = mir_cpuid_cores;
Total number of cores per CPU.
export pure nothrow @nogc @trusted uint mir_cpuid_threads();

export alias threads = mir_cpuid_threads;
Total number of threads per CPU.
export pure nothrow @nogc @trusted immutable(Cache)[] mir_cpuid_dCache();

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

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

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

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

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

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