Struct sysinfo::System

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

Structs containing system’s information.

Trait Implementations§

source§

impl Debug for System

source§

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

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

impl Default for System

source§

fn default() -> System

Returns the “default value” for a type. Read more
source§

impl SystemExt for System

source§

const IS_SUPPORTED: bool = true

Returns true if this OS is supported. Please refer to the crate-level documentation to get the list of supported OSes. Read more
source§

const SUPPORTED_SIGNALS: &'static [Signal] = _

Returns the list of the supported signals on this system (used by ProcessExt::kill_with). Read more
source§

const MINIMUM_CPU_UPDATE_INTERVAL: Duration = _

This is the minimum interval time used internally by sysinfo to refresh the CPU time. Read more
source§

fn new_with_specifics(refreshes: RefreshKind) -> System

Creates a new System instance and refresh the data corresponding to the given RefreshKind. Read more
source§

fn refresh_memory(&mut self)

Refreshes RAM and SWAP usage. Read more
source§

fn refresh_components_list(&mut self)

Refreshes components list. Read more
source§

fn refresh_cpu_specifics(&mut self, refresh_kind: CpuRefreshKind)

Refreshes CPUs specific information. Read more
source§

fn refresh_processes_specifics(&mut self, refresh_kind: ProcessRefreshKind)

Gets all processes and updates the specified information. Read more
source§

fn refresh_process_specifics( &mut self, pid: Pid, refresh_kind: ProcessRefreshKind ) -> bool

Refreshes only the process corresponding to pid. Returns false if the process doesn’t exist (it will NOT be removed from the processes if it doesn’t exist anymore). If it isn’t listed yet, it’ll be added. Read more
source§

fn refresh_disks_list(&mut self)

The disk list will be emptied then completely recomputed. Read more
source§

fn refresh_users_list(&mut self)

Refreshes users list. Read more
source§

fn processes(&self) -> &HashMap<Pid, Process>

Returns the process list. Read more
source§

fn process(&self, pid: Pid) -> Option<&Process>

Returns the process corresponding to the given pid or None if no such process exists. Read more
source§

fn global_cpu_info(&self) -> &Cpu

Returns “global” CPUs information (aka the addition of all the CPUs). Read more
source§

fn cpus(&self) -> &[Cpu]

Returns the list of the CPUs. Read more
source§

fn physical_core_count(&self) -> Option<usize>

Returns the number of physical cores on the CPU or None if it couldn’t get it. Read more
source§

fn networks(&self) -> &Networks

Returns the network interfaces object. Read more
source§

fn networks_mut(&mut self) -> &mut Networks

Returns a mutable access to network interfaces. Read more
source§

fn total_memory(&self) -> u64

Returns the RAM size in bytes. Read more
source§

fn free_memory(&self) -> u64

Returns the amount of free RAM in bytes. Read more
source§

fn available_memory(&self) -> u64

Returns the amount of available RAM in bytes. Read more
source§

fn used_memory(&self) -> u64

Returns the amount of used RAM in bytes. Read more
source§

fn total_swap(&self) -> u64

Returns the SWAP size in bytes. Read more
source§

fn free_swap(&self) -> u64

Returns the amount of free SWAP in bytes. Read more
source§

fn used_swap(&self) -> u64

Returns the amount of used SWAP in bytes. Read more
source§

fn components(&self) -> &[Component]

Returns the components list. Read more
source§

fn components_mut(&mut self) -> &mut [Component]

Returns a mutable components list. Read more
source§

fn disks(&self) -> &[Disk]

Returns the disks list. Read more
source§

fn disks_mut(&mut self) -> &mut [Disk]

Returns the disks list. Read more
source§

fn sort_disks_by<F>(&mut self, compare: F)where F: FnMut(&Disk, &Disk) -> Ordering,

Sort the disk list with the provided callback. Read more
source§

fn uptime(&self) -> u64

Returns system uptime (in seconds). Read more
source§

fn load_average(&self) -> LoadAvg

Returns the system load average value. Read more
source§

fn users(&self) -> &[User]

Returns the users list. Read more
source§

fn boot_time(&self) -> u64

Returns the time (in seconds) when the system booted since UNIX epoch. Read more
source§

fn name(&self) -> Option<String>

Returns the system name. Read more
source§

fn long_os_version(&self) -> Option<String>

Returns the system long os version (e.g “MacOS 11.2 BigSur”). Read more
source§

fn host_name(&self) -> Option<String>

Returns the system hostname based off DNS Read more
source§

fn kernel_version(&self) -> Option<String>

Returns the system’s kernel version. Read more
source§

fn os_version(&self) -> Option<String>

Returns the system version (e.g. for MacOS this will return 11.1 rather than the kernel version). Read more
source§

fn distribution_id(&self) -> String

Returns the distribution id as defined by os-release, or std::env::consts::OS. Read more
source§

fn new() -> Self

Creates a new System instance with nothing loaded. If you want to load components, network interfaces or the disks, you’ll have to use the refresh_*_list methods. SystemExt::refresh_networks_list for example. Read more
source§

fn new_all() -> Self

Creates a new System instance with everything loaded. Read more
source§

fn refresh_specifics(&mut self, refreshes: RefreshKind)

Refreshes according to the given RefreshKind. It calls the corresponding “refresh_” methods. Read more
source§

fn refresh_all(&mut self)

Refreshes all system, processes, disks and network interfaces information. Read more
source§

fn refresh_system(&mut self)

Refreshes system information (RAM, swap, CPU usage and components’ temperature). Read more
source§

fn refresh_cpu(&mut self)

Refreshes CPUs information. Read more
source§

fn refresh_components(&mut self)

Refreshes components’ temperature. Read more
source§

fn refresh_processes(&mut self)

Gets all processes and updates their information. Read more
source§

fn refresh_process(&mut self, pid: Pid) -> bool

Refreshes only the process corresponding to pid. Returns false if the process doesn’t exist (it will NOT be removed from the processes if it doesn’t exist anymore). If it isn’t listed yet, it’ll be added. Read more
source§

fn refresh_disks(&mut self)

Refreshes the listed disks’ information. Read more
source§

fn refresh_networks(&mut self)

Refreshes networks data. Read more
source§

fn refresh_networks_list(&mut self)

The network list will be updated: removing not existing anymore interfaces and adding new ones. Read more
source§

fn processes_by_name<'a: 'b, 'b>( &'a self, name: &'b str ) -> Box<dyn Iterator<Item = &'a Process> + 'b>

Returns an iterator of process containing the given name. Read more
source§

fn processes_by_exact_name<'a: 'b, 'b>( &'a self, name: &'b str ) -> Box<dyn Iterator<Item = &'a Process> + 'b>

Returns an iterator of processes with exactly the given name. Read more
source§

fn get_user_by_id(&self, user_id: &Uid) -> Option<&User>

Returns the User matching the given user_id. Read more

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.