pub struct CpuInfo {
pub vendor: CpuVendor,
pub vendor_id: [u8; 12],
pub features: CpuFeatures,
pub supported_xcr0: u64,
pub xsave_size_current: usize,
pub xsave_size_max: usize,
pub family: u16,
pub model: u8,
pub stepping: u8,
pub model_name: [u8; 48],
model_name_len: usize,
}Expand description
Cached CPU identification and feature information.
Fields§
§vendor: CpuVendor§vendor_id: [u8; 12]Raw CPUID(0) vendor string (EBX:EDX:ECX, 12 bytes, not NUL-terminated).
Preserves vendors classified as CpuVendor::Unknown by
Self::vendor_string.
features: CpuFeatures§supported_xcr0: u64Bitmap of extended state components the CPU supports (CPUID.(0D,0):EDX:EAX). Capability bitmap, not a maximum value.
xsave_size_current: usizeXSAVE area size (bytes) for the components enabled in XCR0 at
detect() time (CPUID.(0D,0):EBX). Depends on the OS-enabled state —
use xsave_size_for_xcr0 for arbitrary masks.
xsave_size_max: usizeXSAVE area size (bytes) required if every supported component were enabled (CPUID.(0D,0):ECX). Upper bound for synthetic XCR0 masks.
family: u16§model: u8§stepping: u8§model_name: [u8; 48]§model_name_len: usizeImplementations§
Source§impl CpuInfo
impl CpuInfo
Sourcepub fn model_name_str(&self) -> &str
pub fn model_name_str(&self) -> &str
Return the model name as a &str.
Sourcepub fn vendor_string(&self) -> &'static str
pub fn vendor_string(&self) -> &'static str
Return a vendor id string (e.g. “GenuineIntel”).
Source§impl CpuInfo
impl CpuInfo
Sourcepub fn avx_usable(&self) -> bool
pub fn avx_usable(&self) -> bool
Whether AVX may actually be executed: the hardware announces it AND
the kernel enabled the required states (CR4.OSXSAVE via XSAVE +
XCR0 bits 0|1|2). Never gate code paths on features.contains(AVX)
alone : that only reflects CPUID, not what the OS programmed.
Sourcepub fn avx512_usable(&self) -> bool
pub fn avx512_usable(&self) -> bool
Whether AVX-512 may actually be executed: hardware support plus all
required XCR0 states enabled (opmask, ZMM_Hi256, HI16_ZMM on top of
x87/SSE/AVX). See avx_usable.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CpuInfo
impl RefUnwindSafe for CpuInfo
impl Send for CpuInfo
impl Sync for CpuInfo
impl Unpin for CpuInfo
impl UnsafeUnpin for CpuInfo
impl UnwindSafe for CpuInfo
Blanket Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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