Struct Cpu

Source
pub struct Cpu<'cpu_info>(/* private fields */);
Expand description

Information about a single CPU.

Implementations§

Source§

impl<'cpu_info> Cpu<'cpu_info>

Source

pub fn get(&self, key: &str) -> Option<&str>

Return the raw value stored under the given key if available.

Source

pub fn processor(&self) -> Option<usize>

Return the processor ID if available.

Source

pub fn vendor_id(&self) -> Option<&str>

Return the vendor ID if available.

Source

pub fn cpu_family(&self) -> Option<u8>

Return the CPU family if available.

Source

pub fn model(&self) -> Option<usize>

Return the CPU model if available.

Source

pub fn model_name(&self) -> Option<&str>

Return the model name if available.

Source

pub fn stepping(&self) -> Option<usize>

Return the stepping size if available.

Source

pub fn microcode(&self) -> Option<usize>

Return the microcode version if available.

Source

pub fn cpu_mhz(&self) -> Option<f32>

Return the CPU frequency in Megahertz if available.

Source

pub fn cache_size(&self) -> Option<usize>

Return the cache size in bytes if available.

Source

pub fn physical_id(&self) -> Option<usize>

Return the physical ID if available.

Source

pub fn siblings(&self) -> Option<usize>

Return the amount of siblings if available.

Source

pub fn core_id(&self) -> Option<usize>

Return the core ID if available.

Source

pub fn cpu_cores(&self) -> Option<usize>

Return the amount of CPU cores if available.

Source

pub fn apicid(&self) -> Option<usize>

Return the APIC ID if available.

Source

pub fn initial_apicid(&self) -> Option<usize>

Return the initial APIC ID if available.

Source

pub fn fpu(&self) -> Option<bool>

Return the FPU flag if available.

Source

pub fn fpu_exception(&self) -> Option<bool>

Return the FPU exception flag if available.

Source

pub fn cpuid_level(&self) -> Option<usize>

Return the CPU ID level if available.

Source

pub fn wp(&self) -> Option<bool>

Return the WP flag if available.

Source

pub fn flags(&self) -> HashSet<&str>

Return the available flags.

Source

pub fn vmx_flags(&self) -> HashSet<&str>

Return the available VMX flags.

Source

pub fn bugs(&self) -> HashSet<&str>

Return the known bugs.

Source

pub fn bogomips(&self) -> Option<f32>

Return the bogo MIPS if available.

Source

pub fn clflush_size(&self) -> Option<usize>

Return the CL flush size if available.

Source

pub fn cache_alignment(&self) -> Option<usize>

Return the cache alignment if available.

Source

pub fn address_sizes(&self) -> Option<(usize, usize)>

Return the address sizes if available.

§Returns

Returns a tuple of (<pysical>, <virtual>) sizes if available, else None.

Source

pub fn power_management(&self) -> Option<&str>

Returns the power management if available.

Trait Implementations§

Source§

impl<'cpu_info> Debug for Cpu<'cpu_info>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'cpu_info> PartialEq for Cpu<'cpu_info>

Source§

fn eq(&self, other: &Cpu<'cpu_info>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'cpu_info> Eq for Cpu<'cpu_info>

Source§

impl<'cpu_info> StructuralPartialEq for Cpu<'cpu_info>

Auto Trait Implementations§

§

impl<'cpu_info> Freeze for Cpu<'cpu_info>

§

impl<'cpu_info> RefUnwindSafe for Cpu<'cpu_info>

§

impl<'cpu_info> Send for Cpu<'cpu_info>

§

impl<'cpu_info> Sync for Cpu<'cpu_info>

§

impl<'cpu_info> Unpin for Cpu<'cpu_info>

§

impl<'cpu_info> UnwindSafe for Cpu<'cpu_info>

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.