[][src]Struct procfs::CpuInfo

pub struct CpuInfo {
    pub fields: HashMap<String, String>,
    pub cpus: Vec<HashMap<String, String>>,
}

Represents the data from /proc/cpuinfo.

The fields field stores the fields that are common among all CPUs. The cpus field stores CPU-specific info.

For common fields, there are methods that will return the data, converted to a more appropriate data type. These methods will all return None if the field doesn't exist, or is in some unexpected format (in that case, you'll have to access the string data directly).

Fields

fields: HashMap<String, String>

This stores fields that are common among all CPUs

cpus: Vec<HashMap<String, String>>

Implementations

impl CpuInfo[src]

pub fn new() -> ProcResult<CpuInfo>[src]

pub fn num_cores(&self) -> usize[src]

Get the total number of cpu cores.

This is the number of entries in the /proc/cpuinfo file.

pub fn get_info(&self, cpu_num: usize) -> Option<HashMap<&str, &str>>[src]

Get info for a specific cpu.

This will merge the common fields with the cpu-specific fields.

Returns None if the requested cpu index is not found.

pub fn model_name(&self, cpu_num: usize) -> Option<&str>[src]

pub fn vendor_id(&self, cpu_num: usize) -> Option<&str>[src]

pub fn physical_id(&self, cpu_num: usize) -> Option<u32>[src]

May not be available on some older 2.6 kernels

pub fn flags(&self, cpu_num: usize) -> Option<Vec<&str>>[src]

Trait Implementations

impl Debug for CpuInfo[src]

Auto Trait Implementations

impl RefUnwindSafe for CpuInfo

impl Send for CpuInfo

impl Sync for CpuInfo

impl Unpin for CpuInfo

impl UnwindSafe for CpuInfo

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.