Struct CpuId
pub struct CpuId<R>where
R: CpuIdReader,{ /* private fields */ }
dep_raw_cpuid
only.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§
§impl CpuId<CpuIdReaderNative>
impl CpuId<CpuIdReaderNative>
pub fn new() -> CpuId<CpuIdReaderNative>
pub fn new() -> CpuId<CpuIdReaderNative>
Create a new CpuId
instance.
§impl<R> CpuId<R>where
R: CpuIdReader,
impl<R> CpuId<R>where
R: CpuIdReader,
pub fn with_cpuid_reader(cpuid_fn: R) -> CpuId<R>
pub fn with_cpuid_reader(cpuid_fn: R) -> CpuId<R>
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.
pub fn with_cpuid_fn(cpuid_fn: R) -> CpuId<R>
pub fn with_cpuid_fn(cpuid_fn: R) -> CpuId<R>
§Note
This function will likely be deprecated in the future. Use the identical
with_cpuid_reader
function instead.
pub 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
pub fn get_feature_info(&self) -> Option<FeatureInfo> ⓘ
pub fn get_feature_info(&self) -> Option<FeatureInfo> ⓘ
pub fn get_cache_info(&self) -> Option<CacheInfoIter> ⓘ
pub fn get_cache_info(&self) -> Option<CacheInfoIter> ⓘ
pub fn get_processor_serial(&self) -> Option<ProcessorSerial> ⓘ
pub fn get_processor_serial(&self) -> Option<ProcessorSerial> ⓘ
pub fn get_cache_parameters(&self) -> Option<CacheParametersIter<R>> ⓘ
pub fn get_cache_parameters(&self) -> Option<CacheParametersIter<R>> ⓘ
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
pub fn get_monitor_mwait_info(&self) -> Option<MonitorMwaitInfo> ⓘ
pub fn get_monitor_mwait_info(&self) -> Option<MonitorMwaitInfo> ⓘ
pub 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
pub fn get_extended_feature_info(&self) -> Option<ExtendedFeatures> ⓘ
pub fn get_extended_feature_info(&self) -> Option<ExtendedFeatures> ⓘ
pub fn get_direct_cache_access_info(&self) -> Option<DirectCacheAccessInfo> ⓘ
pub fn get_direct_cache_access_info(&self) -> Option<DirectCacheAccessInfo> ⓘ
pub fn get_performance_monitoring_info(
&self,
) -> Option<PerformanceMonitoringInfo> ⓘ
pub fn get_performance_monitoring_info( &self, ) -> Option<PerformanceMonitoringInfo> ⓘ
pub fn get_extended_topology_info(&self) -> Option<ExtendedTopologyIter<R>> ⓘ
pub fn get_extended_topology_info(&self) -> Option<ExtendedTopologyIter<R>> ⓘ
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
pub fn get_extended_topology_info_v2(&self) -> Option<ExtendedTopologyIter<R>> ⓘ
pub fn get_extended_topology_info_v2(&self) -> Option<ExtendedTopologyIter<R>> ⓘ
pub fn get_extended_state_info(&self) -> Option<ExtendedStateInfo<R>> ⓘ
pub fn get_extended_state_info(&self) -> Option<ExtendedStateInfo<R>> ⓘ
pub fn get_rdt_monitoring_info(&self) -> Option<RdtMonitoringInfo<R>> ⓘ
pub fn get_rdt_monitoring_info(&self) -> Option<RdtMonitoringInfo<R>> ⓘ
pub fn get_rdt_allocation_info(&self) -> Option<RdtAllocationInfo<R>> ⓘ
pub fn get_rdt_allocation_info(&self) -> Option<RdtAllocationInfo<R>> ⓘ
pub fn get_sgx_info(&self) -> Option<SgxInfo<R>> ⓘ
pub fn get_sgx_info(&self) -> Option<SgxInfo<R>> ⓘ
pub fn get_processor_trace_info(&self) -> Option<ProcessorTraceInfo> ⓘ
pub fn get_processor_trace_info(&self) -> Option<ProcessorTraceInfo> ⓘ
pub fn get_tsc_info(&self) -> Option<TscInfo> ⓘ
pub fn get_tsc_info(&self) -> Option<TscInfo> ⓘ
pub fn get_processor_frequency_info(&self) -> Option<ProcessorFrequencyInfo> ⓘ
pub fn get_processor_frequency_info(&self) -> Option<ProcessorFrequencyInfo> ⓘ
pub fn get_soc_vendor_info(&self) -> Option<SoCVendorInfo<R>> ⓘ
pub fn get_soc_vendor_info(&self) -> Option<SoCVendorInfo<R>> ⓘ
pub fn get_deterministic_address_translation_info(&self) -> Option<DatIter<R>> ⓘ
pub fn get_deterministic_address_translation_info(&self) -> Option<DatIter<R>> ⓘ
pub fn get_hypervisor_info(&self) -> Option<HypervisorInfo<R>> ⓘ
pub fn get_hypervisor_info(&self) -> Option<HypervisorInfo<R>> ⓘ
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.
pub fn get_extended_processor_and_feature_identifiers(
&self,
) -> Option<ExtendedProcessorFeatureIdentifiers> ⓘ
pub fn get_extended_processor_and_feature_identifiers( &self, ) -> Option<ExtendedProcessorFeatureIdentifiers> ⓘ
pub fn get_processor_brand_string(&self) -> Option<ProcessorBrandString> ⓘ
pub fn get_processor_brand_string(&self) -> Option<ProcessorBrandString> ⓘ
pub fn get_l1_cache_and_tlb_info(&self) -> Option<L1CacheTlbInfo> ⓘ
pub fn get_l1_cache_and_tlb_info(&self) -> Option<L1CacheTlbInfo> ⓘ
pub fn get_l2_l3_cache_and_tlb_info(&self) -> Option<L2And3CacheTlbInfo> ⓘ
pub fn get_l2_l3_cache_and_tlb_info(&self) -> Option<L2And3CacheTlbInfo> ⓘ
pub fn get_advanced_power_mgmt_info(&self) -> Option<ApmInfo> ⓘ
pub fn get_advanced_power_mgmt_info(&self) -> Option<ApmInfo> ⓘ
pub 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
pub 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
pub fn get_tlb_1gb_page_info(&self) -> Option<Tlb1gbPageInfo> ⓘ
pub fn get_tlb_1gb_page_info(&self) -> Option<Tlb1gbPageInfo> ⓘ
pub fn get_performance_optimization_info(
&self,
) -> Option<PerformanceOptimizationInfo> ⓘ
pub fn get_performance_optimization_info( &self, ) -> Option<PerformanceOptimizationInfo> ⓘ
pub fn get_processor_topology_info(&self) -> Option<ProcessorTopologyInfo> ⓘ
pub fn get_processor_topology_info(&self) -> Option<ProcessorTopologyInfo> ⓘ
pub fn get_memory_encryption_info(&self) -> Option<MemoryEncryptionInfo> ⓘ
pub fn get_memory_encryption_info(&self) -> Option<MemoryEncryptionInfo> ⓘ
Trait Implementations§
§impl<R> Clone for CpuId<R>where
R: Clone + CpuIdReader,
impl<R> Clone for CpuId<R>where
R: Clone + CpuIdReader,
§impl<R> Debug for CpuId<R>where
R: CpuIdReader,
impl<R> Debug for CpuId<R>where
R: CpuIdReader,
§impl Default for CpuId<CpuIdReaderNative>
impl Default for CpuId<CpuIdReaderNative>
§fn default() -> CpuId<CpuIdReaderNative>
fn default() -> CpuId<CpuIdReaderNative>
Create a new CpuId
instance.
impl<R> Copy for CpuId<R>where
R: Copy + CpuIdReader,
Auto Trait Implementations§
impl<R> Freeze for CpuId<R>where
R: Freeze,
impl<R> RefUnwindSafe for CpuId<R>where
R: RefUnwindSafe,
impl<R> Send for CpuId<R>where
R: Send,
impl<R> Sync for CpuId<R>where
R: Sync,
impl<R> Unpin for CpuId<R>where
R: Unpin,
impl<R> UnwindSafe for CpuId<R>where
R: UnwindSafe,
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ByteSized for T
impl<T> ByteSized for T
Source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Source§fn byte_align(&self) -> usize ⓘ
fn byte_align(&self) -> usize ⓘ
Source§fn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Source§impl<T, R> Chain<R> for Twhere
T: ?Sized,
impl<T, R> Chain<R> for Twhere
T: ?Sized,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ExtAny for T
impl<T> ExtAny for T
Source§fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Source§impl<T> ExtMem for Twhere
T: ?Sized,
impl<T> ExtMem for Twhere
T: ?Sized,
Source§const NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Source§fn mem_align_of_val(&self) -> usize ⓘ
fn mem_align_of_val(&self) -> usize ⓘ
Source§fn mem_size_of_val(&self) -> usize ⓘ
fn mem_size_of_val(&self) -> usize ⓘ
Source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true
if dropping values of this type matters. Read moreSource§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self
without running its destructor. Read moreSource§fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Source§unsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
unsafe_slice
only.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Hook for T
impl<T> Hook for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError> ⓘ
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError> ⓘ
§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out
indicating that a T
is niched.