pub struct CpuInfo { /* private fields */ }
Expand description
Represent the content of the /proc/cpuinfo, returned by cpuinfo()
.
It is an Vec<Process> actually, but provides two useful method : logical_core_num() and physical_core_num()
This struct implement Index trait.
Implementations§
Source§impl CpuInfo
impl CpuInfo
Sourcepub fn logical_core_num(&self) -> usize
pub fn logical_core_num(&self) -> usize
Return logical core number
This is the numbers of the entry in /proc/cpuinfo.
Sourcepub fn physical_core_num(&self) -> usize
pub fn physical_core_num(&self) -> usize
Return physical core number
This is caculated from core id
.
Note: This method will panic if core id
doesn’t appear.
Field core id
only appears on SMP machine.
In this case, physical core numbers equals to logical core numbers.
Trait Implementations§
impl StructuralPartialEq for CpuInfo
Auto Trait Implementations§
impl Freeze for CpuInfo
impl RefUnwindSafe for CpuInfo
impl Send for CpuInfo
impl Sync for CpuInfo
impl Unpin 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
Mutably borrows from an owned value. Read more