Struct procfs::CpuInfo [−][src]
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,