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§
source§impl CpuId
impl CpuId
sourcepub fn with_cpuid_fn(cpuid_fn: fn(_: u32, _: u32) -> CpuIdResult) -> Self
pub fn with_cpuid_fn(cpuid_fn: fn(_: u32, _: u32) -> CpuIdResult) -> Self
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.
sourcepub fn get_vendor_info(&self) -> Option<VendorInfo>
pub fn get_vendor_info(&self) -> Option<VendorInfo>
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
sourcepub fn get_feature_info(&self) -> Option<FeatureInfo>
pub fn get_feature_info(&self) -> Option<FeatureInfo>
sourcepub fn get_cache_info(&self) -> Option<CacheInfoIter>
pub fn get_cache_info(&self) -> Option<CacheInfoIter>
sourcepub fn get_processor_serial(&self) -> Option<ProcessorSerial>
pub fn get_processor_serial(&self) -> Option<ProcessorSerial>
sourcepub fn get_cache_parameters(&self) -> Option<CacheParametersIter>
pub fn get_cache_parameters(&self) -> Option<CacheParametersIter>
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
sourcepub fn get_monitor_mwait_info(&self) -> Option<MonitorMwaitInfo>
pub fn get_monitor_mwait_info(&self) -> Option<MonitorMwaitInfo>
sourcepub fn get_thermal_power_info(&self) -> Option<ThermalPowerInfo>
pub fn get_thermal_power_info(&self) -> Option<ThermalPowerInfo>
Query information about thermal and power management features of the CPU (LEAF=0x06).
Platforms
🟡 AMD ✅ Intel
sourcepub fn get_extended_feature_info(&self) -> Option<ExtendedFeatures>
pub fn get_extended_feature_info(&self) -> Option<ExtendedFeatures>
sourcepub fn get_direct_cache_access_info(&self) -> Option<DirectCacheAccessInfo>
pub fn get_direct_cache_access_info(&self) -> Option<DirectCacheAccessInfo>
sourcepub fn get_performance_monitoring_info(
&self
) -> Option<PerformanceMonitoringInfo>
pub fn get_performance_monitoring_info( &self ) -> Option<PerformanceMonitoringInfo>
sourcepub fn get_extended_topology_info(&self) -> Option<ExtendedTopologyIter>
pub fn get_extended_topology_info(&self) -> Option<ExtendedTopologyIter>
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
sourcepub fn get_extended_topology_info_v2(&self) -> Option<ExtendedTopologyIter>
pub fn get_extended_topology_info_v2(&self) -> Option<ExtendedTopologyIter>
sourcepub fn get_extended_state_info(&self) -> Option<ExtendedStateInfo>
pub fn get_extended_state_info(&self) -> Option<ExtendedStateInfo>
sourcepub fn get_rdt_monitoring_info(&self) -> Option<RdtMonitoringInfo>
pub fn get_rdt_monitoring_info(&self) -> Option<RdtMonitoringInfo>
sourcepub fn get_rdt_allocation_info(&self) -> Option<RdtAllocationInfo>
pub fn get_rdt_allocation_info(&self) -> Option<RdtAllocationInfo>
sourcepub fn get_sgx_info(&self) -> Option<SgxInfo>
pub fn get_sgx_info(&self) -> Option<SgxInfo>
sourcepub fn get_processor_trace_info(&self) -> Option<ProcessorTraceInfo>
pub fn get_processor_trace_info(&self) -> Option<ProcessorTraceInfo>
sourcepub fn get_tsc_info(&self) -> Option<TscInfo>
pub fn get_tsc_info(&self) -> Option<TscInfo>
sourcepub fn get_processor_frequency_info(&self) -> Option<ProcessorFrequencyInfo>
pub fn get_processor_frequency_info(&self) -> Option<ProcessorFrequencyInfo>
sourcepub fn get_soc_vendor_info(&self) -> Option<SoCVendorInfo>
pub fn get_soc_vendor_info(&self) -> Option<SoCVendorInfo>
sourcepub fn get_deterministic_address_translation_info(&self) -> Option<DatIter>
pub fn get_deterministic_address_translation_info(&self) -> Option<DatIter>
sourcepub fn get_hypervisor_info(&self) -> Option<HypervisorInfo>
pub fn get_hypervisor_info(&self) -> Option<HypervisorInfo>
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.
sourcepub fn get_extended_processor_and_feature_identifiers(
&self
) -> Option<ExtendedProcessorFeatureIdentifiers>
pub fn get_extended_processor_and_feature_identifiers( &self ) -> Option<ExtendedProcessorFeatureIdentifiers>
sourcepub fn get_processor_brand_string(&self) -> Option<ProcessorBrandString>
pub fn get_processor_brand_string(&self) -> Option<ProcessorBrandString>
sourcepub fn get_l1_cache_and_tlb_info(&self) -> Option<L1CacheTlbInfo>
pub fn get_l1_cache_and_tlb_info(&self) -> Option<L1CacheTlbInfo>
sourcepub fn get_l2_l3_cache_and_tlb_info(&self) -> Option<L2And3CacheTlbInfo>
pub fn get_l2_l3_cache_and_tlb_info(&self) -> Option<L2And3CacheTlbInfo>
sourcepub fn get_advanced_power_mgmt_info(&self) -> Option<ApmInfo>
pub fn get_advanced_power_mgmt_info(&self) -> Option<ApmInfo>
sourcepub fn get_processor_capacity_feature_info(
&self
) -> Option<ProcessorCapacityAndFeatureInfo>
pub fn get_processor_capacity_feature_info( &self ) -> Option<ProcessorCapacityAndFeatureInfo>
Processor Capacity Parameters and Extended Feature Identification (LEAF=0x8000_0008).
Platforms
✅ AMD 🟡 Intel
sourcepub fn get_svm_info(&self) -> Option<SvmFeatures>
pub fn get_svm_info(&self) -> Option<SvmFeatures>
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