Struct Process

Source
pub struct Process { /* private fields */ }

Implementations§

Source§

impl Process

Source

pub fn new(pid: Pid) -> ProcessResult<Process>

Source

pub fn current() -> ProcessResult<Process>

Source

pub fn pid(&self) -> Pid

Source

pub fn ppid(&self) -> ProcessResult<Option<Pid>>

Source

pub fn name(&self) -> ProcessResult<String>

Source

pub fn exe(&self) -> ProcessResult<PathBuf>

Source

pub fn cmdline(&self) -> ProcessResult<Option<String>>

On Linux, an Ok(None) is usually due to the process being a kernel thread. The return value is different from Python psutil.

Source

pub fn cmdline_vec(&self) -> ProcessResult<Option<Vec<String>>>

New method, not in Python psutil. On Linux, an Ok(None) is usually due to the process being a kernel thread.

Source

pub fn create_time(&self) -> Duration

The process creation time as a Duration since the boot time. The return value is different from Python psutil.

Source

pub fn parent(&self) -> ProcessResult<Option<Process>>

Preemptively checks if the process is still alive.

Source

pub fn parents(&self) -> Option<Vec<Process>>

Source

pub fn status(&self) -> ProcessResult<Status>

Source

pub fn cwd(&self) -> ProcessResult<PathBuf>

Source

pub fn username(&self) -> String

Source

pub fn get_nice(&self) -> i32

Source

pub fn set_nice(&self, nice: i32)

Source

pub fn num_ctx_switches(&self) -> Count

Source

pub fn num_threads(&self) -> Count

Source

pub fn threads(&self)

Source

pub fn cpu_times(&self) -> ProcessResult<ProcessCpuTimes>

Source

pub fn cpu_percent(&mut self) -> ProcessResult<Percent>

Returns the cpu percent since the process was created, replaced, or since the last time this method was called. Differs from Python psutil since there is no interval argument.

Source

pub fn memory_info(&self) -> ProcessResult<MemoryInfo>

Source

pub fn memory_full_info(&self)

Source

pub fn memory_percent(&self) -> ProcessResult<Percent>

Source

pub fn memory_percent_oneshot( &self, virtual_memory: &VirtualMemory, ) -> ProcessResult<Percent>

Source

pub fn memory_percent_with_type(&self, type: MemType) -> ProcessResult<Percent>

Source

pub fn children(&self)

Source

pub fn open_files(&self) -> ProcessResult<Vec<OpenFile>>

Source

pub fn connections(&self)

Source

pub fn connections_with_type(&self, type_: NetConnectionType)

Source

pub fn is_running(&self) -> bool

Source

pub fn is_replaced(&self) -> bool

New method, not in Python psutil.

Source

pub fn replace(&mut self) -> bool

New method, not in Python psutil.

Source

pub fn send_signal(&self, signal: Signal) -> ProcessResult<()>

Preemptively checks if the process is still alive.

Source

pub fn suspend(&self) -> ProcessResult<()>

Preemptively checks if the process is still alive.

Source

pub fn resume(&self) -> ProcessResult<()>

Preemptively checks if the process is still alive.

Source

pub fn terminate(&self) -> ProcessResult<()>

Preemptively checks if the process is still alive.

Source

pub fn kill(&self) -> ProcessResult<()>

Preemptively checks if the process is still alive.

Source

pub fn wait(&self)

Trait Implementations§

Source§

impl Clone for Process

Source§

fn clone(&self) -> Process

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Process

Source§

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

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

impl Hash for Process

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Oneshot for Process

Source§

fn cpu_percent_oneshot(&mut self) -> Percent

Returns the cpu percent since the process was created, replaced, or since the last time this method was called. Differs from Python psutil since there is no interval argument.

Source§

fn name_oneshot(&self) -> String

Source§

fn cpu_times_oneshot(&self) -> ProcessCpuTimes

Source§

impl PartialEq for Process

Source§

fn eq(&self, other: &Process) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ProcessExt for Process

Source§

fn environ(&self) -> ProcessResult<HashMap<String, String>>

Source§

fn get_ionice(&self) -> i32

Source§

fn set_ionice(&self, _nice: i32)

Source§

fn get_rlimit(&self) -> i32

Source§

fn set_rlimit(&self, _nice: i32)

Source§

fn io_counters(&self) -> IoCounters

Source§

fn get_cpu_affinity(&self) -> i32

Source§

fn set_cpu_affinity(&self, _nice: i32)

Source§

fn cpu_num(&self) -> i32

Source§

fn memory_maps(&self)

Source§

fn procfs_stat(&self) -> ProcessResult<ProcfsStat>

New method, not in Python psutil
Source§

fn procfs_statm(&self) -> ProcessResult<ProcfsStatm>

New method, not in Python psutil
Source§

fn procfs_status(&self) -> ProcessResult<ProcfsStatus>

New method, not in Python psutil
Source§

impl ProcessExt for Process

Source§

impl Eq for Process

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.