ddcpuid 0.20.0

x86 processor information library and application


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

ddcpuid, CPUID tool

ddcpuid is a x86 processor information tool.

$ ddcpuid # Summary is the default mode
Name:        AuthenticAMD AMD Ryzen 9 5950X 16-Core Processor            
Identifier:  Family 0x19 Model 0x21 Stepping 0x0
Cores:       16 cores, 32 threads
Max. Memory: 256 TiB physical, 256 TiB virtual
Baseline:    x86-64-v3
Techs:       core-performance-boost htt
Extensions:  x87/fpu +f16c mmx extmmx amd64/x86-64 +lahf64 amd-v/vmx +svm=v1 aes-ni adx sha bmi1 bmi2
SSE:         sse sse2 sse3 ssse3 sse4.2 sse4a
AVX:         avx avx2
AMX:         None
Mitigations: ibpb ibrs ibrs_pref stibp stibp_on ssbd
Cache L1-D:   16x   32 KiB,  512 KiB total, si
Cache L1-I:   16x   32 KiB,  512 KiB total, si
Cache L2-U:   16x  512 KiB,    8 MiB total, si ci
Cache L3-U:    2x   32 MiB,   64 MiB total, si nwbv
  • Can be used as a stand-alone tool or as a library. DUB compatible.
  • Fully supports DMD, GDC, and LDC compilers.
  • BetterC compatible, and used by default for the application.
  • Library does not rely on external functions (e.g., C runtime, Druntime, OS).
  • Surpasses CPU-Z, Intel's Go CPUID module, and Druntime's core.cpuid module in terms of x86-related information.
  • Currently featuring 240 CPUID bits documented and counting!

Want to better understand x86 and their technologies? There's the ddcpuid Manual (PDF)!

Officially supports these vendors:

  • "GenuineIntel" - Intel Corporation
  • "AuthenticAMD" - Advanced Micro Devices Inc.
  • "KVMKVMKVM\0\0\0" - Linux built-in Kernel Virtual Machine
  • "Microsoft Hv" - Microsoft Hyper-V interface
  • "VBoxVBoxVBox" - VirtualBox Hyper-V interface
  • "\0\0\0\0\0\0\0\0\0\0\0\0" - VirtualBox minimal interface

NOTE: Features may be influenced by the virtual environment.

1. Usage Examples

1.1. In a Virtual Guest with 2 Cores Allocated

$ ddcpuid
Name:        AuthenticAMD AMD Ryzen 9 5950X 16-Core Processor            
Identifier:  Family 0x19 Model 0x21 Stepping 0x0
Cores:       1 core, 2 threads
Max. Memory: 256 TiB physical, 256 TiB virtual
Baseline:    x86-64
Techs:       htt
Extensions:  x87/fpu mmx extmmx amd64/x86-64 +lahf64 amd-v/vmx +svm=v1 aes-ni
SSE:         sse sse2 sse3 ssse3 sse4.2 sse4a
AVX:         avx avx2
AMX:         None
Mitigations:
ParaVirt.:   KVM
Cache L1-D:    1x   32 KiB,   32 KiB total, si
Cache L1-I:    1x   32 KiB,   32 KiB total, si
Cache L2-U:    1x  512 KiB,  512 KiB total, si ci
Cache L3-U:    1x   32 MiB,   32 MiB total, si nwbv

1.2. Baseline

Under 32-bit hosts, this mode outputs one of the following values: i486, i586, or i686.

Under 64-bit hosts, this mode outputs one of the following values: x86-64, x86-64-v2, x86-64-v3, or x86-64-v4.

Example:

$ ddcpuid --baseline
x86-64-v3

1.3. Raw CPUID Table on Host Computer

$ ddcpuid --raw
| Leaf     | Sub-leaf | EAX      | EBX      | ECX      | EDX      |
|----------|----------|----------|----------|----------|----------|
|        0 |        0 |       10 | 68747541 | 444d4163 | 69746e65 |
|        1 |        0 |   a20f10 | 1d200800 | 7ed8320b | 178bfbff |
|        2 |        0 |        0 |        0 |        0 |        0 |
|        3 |        0 |        0 |        0 |        0 |        0 |
|        4 |        0 |        0 |        0 |        0 |        0 |
|        5 |        0 |       40 |       40 |        3 |       11 |
|        6 |        0 |        4 |        0 |        1 |        0 |
|        7 |        0 |        0 | 219c97a9 |   40069c |       10 |
|        8 |        0 |        0 |        0 |        0 |        0 |
|        9 |        0 |        0 |        0 |        0 |        0 |
|        a |        0 |        0 |        0 |        0 |        0 |
|        b |        0 |        1 |        2 |      100 |       1d |
|        c |        0 |        0 |        0 |        0 |        0 |
|        d |        0 |      207 |      988 |      988 |        0 |
|        e |        0 |        0 |        0 |        0 |        0 |
|        f |        0 |        0 |       ff |        0 |        2 |
|       10 |        0 |        0 |        2 |        0 |        0 |
| 80000000 |        0 | 80000023 | 68747541 | 444d4163 | 69746e65 |
| 80000001 |        0 |   a20f10 | 20000000 | 75c237ff | 2fd3fbff |
| 80000002 |        0 | 20444d41 | 657a7952 | 2039206e | 30353935 |
| 80000003 |        0 | 36312058 | 726f432d | 72502065 | 7365636f |
| 80000004 |        0 | 20726f73 | 20202020 | 20202020 |   202020 |
| 80000005 |        0 | ff40ff40 | ff40ff40 | 20080140 | 20080140 |
| 80000006 |        0 | 48002200 | 68004200 |  2006140 |  2009140 |
| 80000007 |        0 |        0 |       3b |        0 |     6799 |
| 80000008 |        0 |     3030 | 111ef657 |     501f |    10000 |
| 80000009 |        0 |        0 |        0 |        0 |        0 |
| 8000000a |        0 |        1 |     8000 |        0 | 101bbcff |
| 8000000b |        0 |        0 |        0 |        0 |        0 |
| 8000000c |        0 |        0 |        0 |        0 |        0 |
| 8000000d |        0 |        0 |        0 |        0 |        0 |
| 8000000e |        0 |        0 |        0 |        0 |        0 |
| 8000000f |        0 |        0 |        0 |        0 |        0 |
| 80000010 |        0 |        0 |        0 |        0 |        0 |
| 80000011 |        0 |        0 |        0 |        0 |        0 |
| 80000012 |        0 |        0 |        0 |        0 |        0 |
| 80000013 |        0 |        0 |        0 |        0 |        0 |
| 80000014 |        0 |        0 |        0 |        0 |        0 |
| 80000015 |        0 |        0 |        0 |        0 |        0 |
| 80000016 |        0 |        0 |        0 |        0 |        0 |
| 80000017 |        0 |        0 |        0 |        0 |        0 |
| 80000018 |        0 |        0 |        0 |        0 |        0 |
| 80000019 |        0 | f040f040 | f0400000 |        0 |        0 |
| 8000001a |        0 |        6 |        0 |        0 |        0 |
| 8000001b |        0 |      3ff |        0 |        0 |        0 |
| 8000001c |        0 |        0 |        0 |        0 |        0 |
| 8000001d |        0 |     4121 |  1c0003f |       3f |        0 |
| 8000001e |        0 |       1d |      10e |        0 |        0 |
| 8000001f |        0 |    1780f |      173 |      1fd |        1 |
| 80000020 |        0 |        0 |        2 |        0 |        0 |
| 80000021 |        0 |       4d |        0 |        0 |        0 |
| 80000022 |        0 |        0 |        0 |        0 |        0 |
| 80000023 |        0 |        0 |        0 |        0 |        0 |

1.4. All Information Output

For more information in the fashion of Linux's /proc/cpuinfo, use the -a or --all switches. Warning, this really outputs a lot of information!

This mode really includes all processor information, including paravirtualization features and Hyper-V's extremely long list of feature bits, if detected.

2. Compiling

The best way to compile ddcpuid is by using DUB.

Compilers supported:

2.1. DUB

Using dub(1) is rather straightforward.

Once installed, navigate to the root directory of the project and to perform a debug build, simply do: dub build

For a release build: dub build -b release-nobounds

To select a different compiler: dub build --compiler=ldc2

For more information, visit this page.

2.2. Makefile

The Makefile relies on GNU Make (gmake/gnumake).

Available variables:

  • DC: D compiler, defaults to dmd
  • PREFIX: installation path prefix, defaults to /usr/local

Available actions:

  • debug (default)
  • release
  • install
  • uninstall

Examples:

  • make: Produce a debug build
  • make release DC=ldc: Produce a release build with LDC

2.3. Manually

Since ddcpuid only consists of two source files, both being in the src folder, it's still pretty simple to perform a compilation by hand.

Here's an example that works on any compiler:

dmd src/ddcpuid.d src/main.d -ofddcpuid
ldc2 src/ddcpuid.d src/main.d -ofddcpuid
gdc src/ddcpuid.d src/main.d -oddcpuid

If you want an optimized build:

dmd -betterC -release -O -boundscheck=off src/ddcpuid.d src/main.d -oddcpuid
ldc2 -betterC -release -O -boundscheck=off src/ddcpuid.d src/main.d -oddcpuid
gdc -fno-druntime -release -O -fbounds-check=off src/ddcpuid.d src/main.d -oddcpuid

You get the idea.

2.4. GDC Issues

2.4.1. GDC and betterC

Versions earlier than 11 will not compile using -fno-druntime due to linking issues: undefined reference to '__gdc_personality_v0'.

2.5. LDC Issues

2.5.1. Legacy stdio Definitions

On Windows, LDC versions 1.13 and 1.14 do not include legacy_stdio_definitions.lib when linking, making it impossible to compile the project using -betterC.

Authors:
Dependencies:
none
Versions:
0.21.1 2023-Oct-13
0.21.0 2022-Oct-02
0.20.0 2022-Mar-27
0.20.0-rc.3 2022-Mar-20
0.20.0-rc.2 2022-Mar-20
Show all 11 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 33 downloads total

Score:
0.3
Short URL:
ddcpuid.dub.pm