pub struct CpuId { /* private fields */ }
Expand description

The main type used to query information about the CPU we’re running on.

Other structs can be accessed by going through this type.

Implementations

Return new CpuId struct.

Return new CpuId struct with custom reader function.

This is useful for example when testing code or if we want to interpose on the CPUID calls this library makes.

Return information about the vendor (LEAF=0x00).

This leaf will contain a ASCII readable string such as “GenuineIntel” for Intel CPUs or “AuthenticAMD” for AMD CPUs.

Platforms

✅ AMD ✅ Intel

Query a set of features that are available on this CPU (LEAF=0x01).

Platforms

✅ AMD ✅ Intel

Query basic information about caches (LEAF=0x02).

Platforms

❌ AMD ✅ Intel

Retrieve serial number of processor (LEAF=0x03).

Platforms

❌ AMD ✅ Intel

Retrieve more elaborate information about caches (LEAF=0x04 or 0x8000_001D).

As opposed to get_cache_info, this will tell us about associativity, set size, line size of each level in the cache hierarchy.

Platforms

🟡 AMD ✅ Intel

Information about how monitor/mwait works on this CPU (LEAF=0x05).

Platforms

🟡 AMD ✅ Intel

Query information about thermal and power management features of the CPU (LEAF=0x06).

Platforms

🟡 AMD ✅ Intel

Find out about more features supported by this CPU (LEAF=0x07).

Platforms

🟡 AMD ✅ Intel

Direct cache access info (LEAF=0x09).

Platforms

❌ AMD ✅ Intel

Info about performance monitoring (LEAF=0x0A).

Platforms

❌ AMD ✅ Intel

Information about topology (LEAF=0x0B).

Intel SDM suggests software should check support for leaf 0x1F (CpuId::get_extended_topology_info_v2), and if supported, enumerate that leaf instead.

Platforms

✅ AMD ✅ Intel

Extended information about topology (LEAF=0x1F).

Platforms

❌ AMD ✅ Intel

Information for saving/restoring extended register state (LEAF=0x0D).

Platforms

✅ AMD ✅ Intel

Quality of service monitoring information (LEAF=0x0F).

Platforms

❌ AMD ✅ Intel

Quality of service enforcement information (LEAF=0x10).

Platforms

❌ AMD ✅ Intel

Information about secure enclave support (LEAF=0x12).

Platforms

❌ AMD ✅ Intel

Intel Processor Trace Enumeration Information (LEAF=0x14).

Platforms

❌ AMD ✅ Intel

Time Stamp Counter/Core Crystal Clock Information (LEAF=0x15).

Platforms

❌ AMD ✅ Intel

Processor Frequency Information (LEAF=0x16).

Platforms

❌ AMD ✅ Intel

Contains SoC vendor specific information (LEAF=0x17).

Platforms

❌ AMD ✅ Intel

Query deterministic address translation feature (LEAF=0x18).

Platforms

❌ AMD ✅ Intel

Returns information provided by the hypervisor, if running in a virtual environment (LEAF=0x4000_00xx).

Platform

Needs to be a virtual CPU to be supported.

Extended Processor and Processor Feature Identifiers (LEAF=0x8000_0001).

Platforms

✅ AMD 🟡 Intel

Retrieve processor brand string (LEAF=0x8000_000{2..4}).

Platforms

✅ AMD ✅ Intel

L1 Instruction Cache Information (LEAF=0x8000_0005)

Platforms

✅ AMD ❌ Intel (reserved)

L2/L3 Cache and TLB Information (LEAF=0x8000_0006).

Platforms

✅ AMD 🟡 Intel

Advanced Power Management Information (LEAF=0x8000_0007).

Platforms

✅ AMD 🟡 Intel

Processor Capacity Parameters and Extended Feature Identification (LEAF=0x8000_0008).

Platforms

✅ AMD 🟡 Intel

This function provides information about the SVM features that the processory supports. (LEAF=0x8000_000A)

If SVM is not supported if ExtendedProcessorFeatureIdentifiers::has_svm is false, this function is reserved then.

Platforms

✅ AMD ❌ Intel

TLB 1-GiB Pages Information (LEAF=0x8000_0019)

Platforms

✅ AMD ❌ Intel

Informations about performance optimization (LEAF=0x8000_001A)

Platforms

✅ AMD ❌ Intel (reserved)

Informations about processor topology (LEAF=0x8000_001E)

Platforms

✅ AMD ❌ Intel (reserved)

Informations about memory encryption support (LEAF=0x8000_001F)

Platforms

✅ AMD ❌ Intel (reserved)

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.