cpu_id_t(3)
okay so bestie, welcome to cpu_id_t(3) โ straight outta the Library Functions Manual, and it's giving "every single thing libcpuid knows about your CPU, in one struct" ๐๐ pull up a chair, we're going on a field trip into your silicon.
โจ NAME โจ
cpu_id_t โ this contains the recognized CPU features/info ๐
๐ธ SYNOPSIS ๐ธ
#include <libcpuid.h>
๐ Data Fields ๐
cpu_architecture_t architecturecpu_feature_level_t feature_levelchar vendor_str [VENDOR_STR_MAX]char brand_str [BRAND_STR_MAX]cpu_vendor_t vendoruint8_t flags [CPU_FLAGS_MAX]int32_t familyint32_t modelint32_t steppingint32_t ext_familyint32_t ext_modelunion {struct x86_id_t x86struct arm_id_t arm
};int32_t num_coresint32_t num_logical_cpusint32_t total_logical_cpusint32_t l1_data_cacheint32_t l1_instruction_cacheint32_t l2_cacheint32_t l3_cacheint32_t l4_cacheint32_t l1_assocint32_t l1_data_assocint32_t l1_instruction_assocint32_t l2_assocint32_t l3_assocint32_t l4_assocint32_t l1_cachelineint32_t l1_data_cachelineint32_t l1_instruction_cachelineint32_t l2_cachelineint32_t l3_cachelineint32_t l4_cachelineint32_t l1_data_instancesint32_t l1_instruction_instancesint32_t l2_instancesint32_t l3_instancesint32_t l4_instanceschar cpu_codename [CODENAME_STR_MAX]int32_t sse_sizeuint8_t detection_hints [CPU_HINTS_MAX]struct cpu_sgx_t sgxcpu_affinity_mask_t affinity_maskcpu_purpose_t purposechar technology_node [TECHNOLOGY_STR_MAX]
๐ Detailed Description ๐
This contains the recognized CPU features/info. that's it, that's the whole vibe โ one big glowing lil suitcase full of everything your processor is willing to admit about itself ๐งโจ
๐ฆ Field Documentation ๐ฆ
๐ union { ... } cpu_id_t
contains architecture specific info. lowkey you gotta check cpu_id_t::architecture first to know which member is even valid, bestie โ don't just grab one and hope ๐
โญ cpu_affinity_mask_t cpu_id_t::affinity_mask
bitmask of the affinity ids this processor type is occupying ๐ซ
โญ cpu_architecture_t cpu_id_t::architecture
contains the CPU architecture ID (e.g. ARCHITECTURE_X86) โ the "which flavor of CPU are we even talking about" field ๐
โญ char cpu_id_t::brand_str[BRAND_STR_MAX]
contains the brand string, e.g. "Intel(R) Xeon(TM) CPU 2.40GHz" โ that's the marketing name, the one your BIOS yells at you ๐
โญ char cpu_id_t::cpu_codename[CODENAME_STR_MAX]
The brief and human-friendly CPU codename, which was recognized. Examples, in all their glory โจ:
+--------+--------+-------+-------+-------+---------------------------------------+-----------------------+
| Vendor | Family | Model | Step. | Cache | Brand String | cpu_id_t.cpu_codename |
+--------+--------+-------+-------+-------+---------------------------------------+-----------------------+
| AMD | 6 | 8 | 0 | 256 | (not available - will be ignored) | "K6-2" |
| Intel | 15 | 2 | 5 | 512 | "Intel(R) Xeon(TM) CPU 2.40GHz" | "Xeon (Prestonia)" |
| Intel | 6 | 15 | 11 | 4096 | "Intel(R) Core(TM)2 Duo CPU E6550..." | "Conroe (Core 2 Duo)" |
| AMD | 15 | 35 | 2 | 1024 | "Dual Core AMD Opteron(tm) Proces..." | "Opteron (Dual Core)" |
+--------+--------+-------+-------+-------+---------------------------------------+-----------------------+
โญ uint8_t cpu_id_t::detection_hints[CPU_HINTS_MAX]
contain miscellaneous detection information. Used to test about specifics of certain detected features. See the CPU_HINT_* macros below ๐
See also: Hints
โญ int32_t cpu_id_t::ext_family
CPU display ("true") family โ computed as BaseFamily[3:0]+ExtendedFamily[7:0] ๐งฎ
Deprecated: replaced byx86_id_t::ext_family(prefix the member withx86., e.g.id.x86.ext_family) โ like, it still works but it's not the moment anymore ๐
โญ int32_t cpu_id_t::ext_model
CPU display ("true") model โ computed as (ExtendedModel[3:0]<<4) + BaseModel[3:0]. For the full detailed discussion about what BaseModel / ExtendedModel / Model actually are, go read Github issue #150, it's a whole saga ๐
Deprecated: replaced byx86_id_t::ext_model(prefix the member withx86., e.g.id.x86.ext_model) ๐
โญ int32_t cpu_id_t::family
CPU family (BaseFamily[3:0]) ๐ผ
Deprecated: replaced byx86_id_t::family(prefix the member withx86., e.g.id.x86.family)
โญ cpu_feature_level_t cpu_id_t::feature_level
contains the CPU feature level, also know as microarchitecture levels (x86) and architecture version (ARM) ๐๏ธ
โญ uint8_t cpu_id_t::flags[CPU_FLAGS_MAX]
contain CPU flags. Used to test for features. See the CPU_FEATURE_* macros below ๐ฉ
See also: Features
โญ int32_t cpu_id_t::l1_assoc
Cache associativity for the L1 data cache. -1 if undetermined ๐คทโโ๏ธ
Deprecated: replaced by cpu_id_t::l1_data_assoc
โญ int32_t cpu_id_t::l1_cacheline
Cache-line size for L1 data cache. -1 if undetermined ๐
Deprecated: replaced by cpu_id_t::l1_data_cacheline
โญ int32_t cpu_id_t::l1_data_assoc
Cache associativity for the L1 data cache. -1 if undetermined ๐ซ
โญ int32_t cpu_id_t::l1_data_cache
L1 data cache size in KB. Could be zero, if the CPU lacks cache. If the size cannot be determined, it will be -1 ๐พ
โญ int32_t cpu_id_t::l1_data_cacheline
Cache-line size for L1 data cache. -1 if undetermined ๐
โญ int32_t cpu_id_t::l1_data_instances
Number of L1 data cache instances. -1 if undetermined ๐ข
โญ int32_t cpu_id_t::l1_instruction_assoc
Cache associativity for the L1 instruction cache. -1 if undetermined โจ
โญ int32_t cpu_id_t::l1_instruction_cache
L1 instruction cache size in KB. Could be zero, if the CPU lacks cache. If the size cannot be determined, it will be -1 ๐ง
Note: On some Intel CPUs, whose instruction cache is in fact a trace cache, the size will be expressed in K uOps. yes fr, different unit, no cap ๐
โญ int32_t cpu_id_t::l1_instruction_cacheline
Cache-line size for L1 instruction cache. -1 if undetermined ๐
โญ int32_t cpu_id_t::l1_instruction_instances
Number of L1 instruction cache instances. -1 if undetermined ๐ข
โญ int32_t cpu_id_t::l2_assoc
Cache associativity for the L2 cache. -1 if undetermined ๐
โญ int32_t cpu_id_t::l2_cache
L2 cache size in KB. Could be zero, if the CPU lacks L2 cache. If the size of the cache could not be determined, it will be -1 ๐พ
โญ int32_t cpu_id_t::l2_cacheline
Cache-line size for L2 cache. -1 if undetermined ๐
โญ int32_t cpu_id_t::l2_instances
Number of L2 cache instances. -1 if undetermined ๐ข
โญ int32_t cpu_id_t::l3_assoc
Cache associativity for the L3 cache. -1 if undetermined ๐ธ
โญ int32_t cpu_id_t::l3_cache
L3 cache size in KB. Zero on most systems ๐ถ
โญ int32_t cpu_id_t::l3_cacheline
Cache-line size for L3 cache. -1 if undetermined ๐
โญ int32_t cpu_id_t::l3_instances
Number of L3 cache instances. -1 if undetermined ๐ข
โญ int32_t cpu_id_t::l4_assoc
Cache associativity for the L4 cache. -1 if undetermined ๐ฆ
โญ int32_t cpu_id_t::l4_cache
L4 cache size in KB. Zero on most systems ๐ด
โญ int32_t cpu_id_t::l4_cacheline
Cache-line size for L4 cache. -1 if undetermined ๐
โญ int32_t cpu_id_t::l4_instances
Number of L4 cache instances. -1 if undetermined ๐ข
โญ int32_t cpu_id_t::model
CPU model (BaseModel[3:0]) ๐งฌ
Deprecated: replaced byx86_id_t::model(prefix the member withx86., e.g.id.x86.model)
โญ int32_t cpu_id_t::num_cores
Number of CPU cores on the current processor ๐ช
โญ int32_t cpu_id_t::num_logical_cpus
Number of logical processors on the current processor. Could be more than the number of physical cores, e.g. when the processor has HyperThreading. yes, your 4 cores can absolutely clock in as 8, we love a multitasker ๐ญ
โญ cpu_purpose_t cpu_id_t::purpose
processor type purpose, relevant in case of hybrid CPU (e.g. PURPOSE_PERFORMANCE) โ this is for the big-little core girlies ๐
โญ struct cpu_sgx_t cpu_id_t::sgx
contains information about SGX features if the processor, if present ๐
Deprecated: replaced byx86_id_t::sgx(prefix the member withx86., e.g.id.x86.sgx)
โญ int32_t cpu_id_t::sse_size
SSE execution unit size (64 or 128; -1 if N/A) ๐
Deprecated: replaced byx86_id_t::sse_size(prefix the member withx86., e.g.id.x86.sse_size)
โญ int32_t cpu_id_t::stepping
CPU stepping ๐
Deprecated: replaced byx86_id_t::stepping(prefix the member withx86., e.g.id.x86.stepping)
โญ char cpu_id_t::technology_node[TECHNOLOGY_STR_MAX]
contains the technology node string, e.g. "32 nm" ๐ฌ
โญ int32_t cpu_id_t::total_logical_cpus
The total number of logical processors. The same value is available through cpuid_get_total_cpus. ๐
This is num_logical_cpus * {total physical processors in the system} (but only on a real system, under a VM this number may be lower).
If you're writing a multithreaded program and you want to run it on all CPUs, this is the number of threads you need. fr fr, screenshot this part ๐
Note: in a VM, this will exactly match the number of CPUs set in the VM's configuration.
โญ cpu_vendor_t cpu_id_t::vendor
contains the recognized CPU vendor ๐ท๏ธ
โญ char cpu_id_t::vendor_str[VENDOR_STR_MAX]
contains the CPU vendor string, e.g. "GenuineIntel" โ the raw string straight from the CPU's mouth ๐ฌ
๐ Author ๐
Generated automatically by Doxygen for libcpuid from the source code. so like, no human wrote this by hand, the robot did it and honestly it ate ๐คโจ
and that's the whole page bestie!! this was libcpuid, Version 0.8.2, filed under cpu_id_t(3) โ go forth and interrogate your CPU, she loves the attention ๐ ๐๐ฆ
๐ฆ where this page comes from
- fedora 43: libcpuid-devel 0.8.2-1.fc43 ยท BSD-2-Clause
- fedora 43: libcpuid-devel 0.8.2-1.fc43 ยท BSD-2-Clause
- fedora 44: libcpuid-devel 0.8.2-1.fc44 ยท BSD-2-Clause
- fedora 44: libcpuid-devel 0.8.2-1.fc44 ยท BSD-2-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms