pub struct Process { /* private fields */ }
Implementations§
Source§impl Process
impl Process
pub fn new(pid: Pid) -> ProcessResult<Process>
pub fn current() -> ProcessResult<Process>
pub fn pid(&self) -> Pid
pub fn ppid(&self) -> ProcessResult<Option<Pid>>
pub fn name(&self) -> ProcessResult<String>
pub fn exe(&self) -> ProcessResult<PathBuf>
Sourcepub fn cmdline(&self) -> ProcessResult<Option<String>>
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.
Sourcepub fn cmdline_vec(&self) -> ProcessResult<Option<Vec<String>>>
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.
Sourcepub fn create_time(&self) -> Duration
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.
Sourcepub fn parent(&self) -> ProcessResult<Option<Process>>
pub fn parent(&self) -> ProcessResult<Option<Process>>
Preemptively checks if the process is still alive.
pub fn parents(&self) -> Option<Vec<Process>>
pub fn status(&self) -> ProcessResult<Status>
pub fn cwd(&self) -> ProcessResult<PathBuf>
pub fn username(&self) -> String
pub fn get_nice(&self) -> i32
pub fn set_nice(&self, nice: i32)
pub fn num_ctx_switches(&self) -> Count
pub fn num_threads(&self) -> Count
pub fn threads(&self)
pub fn cpu_times(&self) -> ProcessResult<ProcessCpuTimes>
Sourcepub fn cpu_percent(&mut self) -> ProcessResult<Percent>
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.
pub fn memory_info(&self) -> ProcessResult<MemoryInfo>
pub fn memory_full_info(&self)
pub fn memory_percent(&self) -> ProcessResult<Percent>
pub fn memory_percent_oneshot( &self, virtual_memory: &VirtualMemory, ) -> ProcessResult<Percent>
pub fn memory_percent_with_type(&self, type: MemType) -> ProcessResult<Percent>
pub fn children(&self)
pub fn open_files(&self) -> ProcessResult<Vec<OpenFile>>
pub fn connections(&self)
pub fn connections_with_type(&self, type_: NetConnectionType)
pub fn is_running(&self) -> bool
Sourcepub fn is_replaced(&self) -> bool
pub fn is_replaced(&self) -> bool
New method, not in Python psutil.
Sourcepub fn send_signal(&self, signal: Signal) -> ProcessResult<()>
pub fn send_signal(&self, signal: Signal) -> ProcessResult<()>
Preemptively checks if the process is still alive.
Sourcepub fn suspend(&self) -> ProcessResult<()>
pub fn suspend(&self) -> ProcessResult<()>
Preemptively checks if the process is still alive.
Sourcepub fn resume(&self) -> ProcessResult<()>
pub fn resume(&self) -> ProcessResult<()>
Preemptively checks if the process is still alive.
Sourcepub fn terminate(&self) -> ProcessResult<()>
pub fn terminate(&self) -> ProcessResult<()>
Preemptively checks if the process is still alive.
Sourcepub fn kill(&self) -> ProcessResult<()>
pub fn kill(&self) -> ProcessResult<()>
Preemptively checks if the process is still alive.
pub fn wait(&self)
Trait Implementations§
Source§impl Oneshot for Process
impl Oneshot for Process
Source§fn cpu_percent_oneshot(&mut self) -> Percent
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.