Struct sysinfo::Process

source ·
pub struct Process {
    pub tasks: HashMap<Pid, Process>,
    /* private fields */
}
Expand description

Struct containing information of a process.

iOS

This information cannot be retrieved on iOS due to sandboxing.

Apple app store

If you are building a macOS Apple app store, it won’t be able to retrieve this information.

Fields§

§tasks: HashMap<Pid, Process>

Tasks run by this process.

Trait Implementations§

source§

impl Debug for Process

source§

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

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

impl ProcessExt for Process

source§

fn kill_with(&self, signal: Signal) -> Option<bool>

Sends the given signal to the process. If the signal doesn’t exist on this platform, it’ll do nothing and will return None. Otherwise it’ll return if the signal was sent successfully. Read more
source§

fn name(&self) -> &str

Returns the name of the process. Read more
source§

fn cmd(&self) -> &[String]

Returns the command line. Read more
source§

fn exe(&self) -> &Path

Returns the path to the process. Read more
source§

fn pid(&self) -> Pid

Returns the PID of the process. Read more
source§

fn environ(&self) -> &[String]

Returns the environment variables of the process. Read more
source§

fn cwd(&self) -> &Path

Returns the current working directory. Read more
source§

fn root(&self) -> &Path

Returns the path of the root directory. Read more
source§

fn memory(&self) -> u64

Returns the memory usage (in bytes). Read more
source§

fn virtual_memory(&self) -> u64

Returns the virtual memory usage (in bytes). Read more
source§

fn parent(&self) -> Option<Pid>

Returns the parent PID. Read more
source§

fn status(&self) -> ProcessStatus

Returns the status of the process. Read more
source§

fn start_time(&self) -> u64

Returns the time where the process was started (in seconds) from epoch. Read more
source§

fn run_time(&self) -> u64

Returns for how much time the process has been running (in seconds). Read more
source§

fn cpu_usage(&self) -> f32

Returns the total CPU usage (in %). Notice that it might be bigger than 100 if run on a multi-core machine. Read more
source§

fn disk_usage(&self) -> DiskUsage

Returns number of bytes read and written to disk. Read more
source§

fn user_id(&self) -> Option<&Uid>

Returns the ID of the owner user of this process or None if this information couldn’t be retrieved. If you want to get the User from it, take a look at SystemExt::get_user_by_id. Read more
source§

fn effective_user_id(&self) -> Option<&Uid>

Returns the user ID of the effective owner of this process or None if this information couldn’t be retrieved. If you want to get the User from it, take a look at SystemExt::get_user_by_id. Read more
source§

fn group_id(&self) -> Option<Gid>

Returns the process group ID of the process. Read more
source§

fn effective_group_id(&self) -> Option<Gid>

Returns the effective group ID of the process. Read more
source§

fn wait(&self)

Wait for process termination. Read more
source§

fn session_id(&self) -> Option<Pid>

Returns the session ID for the current process or None if it couldn’t be retrieved. Read more
source§

fn kill(&self) -> bool

Sends Signal::Kill to the process (which is the only signal supported on all supported platforms by this crate). Read more
source§

impl Serialize for Process

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Process

§

impl Send for Process

§

impl Sync for Process

§

impl Unpin for Process

§

impl UnwindSafe for Process

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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 = _

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
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

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

Performs the conversion.
§

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

§

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

The type returned in the event of a conversion error.
§

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

Performs the conversion.