Struct linux_procfs::System

source ·
pub struct System { /* private fields */ }
Expand description

system interface of linux-procfs

Implementations§

source§

impl System

source

pub fn new<P: AsRef<Path>>(base_path: P) -> Self

create instance

Example:

use linux_procfs::System;
let mut sys = System::new("/");
source

pub fn get_loadavg(&mut self) -> LoadAvg

/proc/loadavg

source

pub fn get_meminfo(&mut self) -> MemInfo

/proc/meminfo

source

pub fn get_stat(&mut self) -> Stat

/proc/stat

source

pub fn get_uptime(&mut self) -> Uptime

/proc/uptime

source

pub fn get_vmstat(&mut self) -> VmStat

/proc/vmstat

source

pub fn get_diskstats(&mut self) -> DiskStats

/proc/diskstats

source

pub fn get_netdevs(&mut self) -> NetDevs

/proc/net/dev

source

pub fn get_max_cpu_num(&mut self) -> usize

maximum cpu number

source

pub fn get_cpufreqs(&mut self, max_cpu_num: usize) -> CpuFreqs

/sys/devices/system/cpu/cpu0/cpufreq/

source

pub fn get_pids(&mut self) -> Vec<Pid>

/proc/<pid>/

source

pub fn get_pidentries(&mut self) -> PidEntries

/proc/<pid>/{stat, statm, status, cmdline}

source

pub fn get_pidentry_stat(&mut self, pid: Pid) -> Option<PidStat>

/proc/<pid>/stat

source

pub fn get_pidentry_statm(&mut self, pid: Pid) -> Option<PidStatm>

/proc/<pid>/statm

source

pub fn get_pidentry_status(&mut self, pid: Pid) -> Option<PidStatus>

/proc/<pid>/status

source

pub fn get_pidentry_cmdline(&mut self, pid: Pid) -> Option<PidCmdline>

/proc/<pid>/cmdline

source

pub fn get_pidentry_comm(&mut self, pid: Pid) -> Option<PidCmdline>

/proc/<pid>/comm

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.