CpuInfo

Struct CpuInfo 

Source
pub struct CpuInfo {
    pub vendor: String,
    pub brand: String,
    pub codename: String,
    pub num_cores: i32,
    pub num_logical_cpus: i32,
    pub total_logical_cpus: i32,
    pub l1_data_cache: Option<i32>,
    pub l1_instruction_cache: Option<i32>,
    pub l2_cache: Option<i32>,
    pub l3_cache: Option<i32>,
    /* private fields */
}
Expand description

A struct holding information about CPU features.

This data structure is returned by identify(). You can consult libcpuid docs for cpu_id_t for more detailed descriptions of these fields.

Fields§

§vendor: String

CPU vendor string, for example GenuineIntel.

§brand: String

Brand string, for example Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz.

§codename: String

Brief CPU codename, such as Sandy Bridge (Core i5).

§num_cores: i32

Number of physical cores of the current CPU.

§num_logical_cpus: i32

Number of logical processors (may include HyperThreading or such).

§total_logical_cpus: i32

Total number of logical processors.

§l1_data_cache: Option<i32>

L1 data cache size in kB. Some(0) if the CPU lacks cache, None if it couldn’t be determined.

§l1_instruction_cache: Option<i32>

L1 instruction cache size in kB. Some(0) if the CPU lacks cache, None if it couldn’t be determined.

§l2_cache: Option<i32>

L2 cache size in kB. Some(0) if the CPU lacks L2 cache, None if it couldn’t be determined.

§l3_cache: Option<i32>

L3 cache size in kB. Some(0) if the CPU lacks L3 cache, None if it couldn’t be determined.

Implementations§

Source§

impl CpuInfo

Source

pub fn has_feature(&self, feature: CpuFeature) -> bool

Checks if current CPU supports given feature.

See CpuFeature for a list of available feature identifiers.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.