[−][src]Struct heim::process::Process
OS process.
Methods
impl Process
[src]
pub fn pid(&self) -> i32
[src]
Returns the process pid.
pub fn parent_pid(&self) -> impl Future<Output = Result<i32, ProcessError>>
[src]
Returns future which resolves into the process parent pid.
pub fn parent(&self) -> impl Future<Output = Result<Process, ProcessError>>
[src]
Returns future which resolves into the parent Process.
pub fn name(&self) -> impl Future<Output = Result<String, ProcessError>>
[src]
Returns future which resolves into the process name.
pub fn exe(&self) -> impl Future<Output = Result<PathBuf, ProcessError>>
[src]
Returns future which resolves into the process executable as an absolute path.
pub fn cwd(&self) -> impl Future<Output = Result<PathBuf, ProcessError>>
[src]
Returns future which resolves into the process current working directory.
Compatibility
For Windows this method is not implemented yet and will always return an error, see #105.
pub fn status(&self) -> impl Future<Output = Result<Status, ProcessError>>
[src]
Returns future which resolves into the current process status.
pub fn cpu_time(&self) -> impl Future<Output = Result<CpuTime, ProcessError>>
[src]
Returns future which resolves into the accumulated process time.
pub fn cpu_usage(&self) -> impl Future<Output = Result<CpuUsage, ProcessError>>
[src]
Returns future which resolves into the CPU usage measurement.
Returned CpuUsage
struct represents instantaneous CPU usage and does not represent
any reasonable value by itself.
It is suggested to wait for a while with help of any async timer
(for accuracy recommended delay should be at least 100 ms),
call this method once again and subtract former CpuUsage
from the new one.
Same to any *nix system, calculated CPU usage might exceed 100 % if the process is running multiple threads on different CPU cores.
Example
let process = process::current().await?; let measurement_1 = process.cpu_usage().await?; // Or any other async timer at your choice futures_timer::Delay::new(Duration::from_millis(100)).await?; let measurement_2 = process.cpu_usage().await?; println!("CPU usage: {} %", (measurement_2 - measurement_1).get::<ratio::percent>());
pub fn memory(&self) -> impl Future<Output = Result<Memory, ProcessError>>
[src]
Returns future which resolves into the memory information about this process.
Trait Implementations
impl ProcessExt for Process
[src]
fn io_counters(
&self
) -> Pin<Box<dyn Future<Output = Result<IoCounters, ProcessError>> + Send>>
[src]
&self
) -> Pin<Box<dyn Future<Output = Result<IoCounters, ProcessError>> + Send>>
fn net_io_counters(
&self
) -> Pin<Box<dyn Stream<Item = Result<IoCounters, ProcessError>> + Send>>
[src]
&self
) -> Pin<Box<dyn Stream<Item = Result<IoCounters, ProcessError>> + Send>>
impl Debug for Process
[src]
Auto Trait Implementations
impl Send for Process
impl !Unpin for Process
impl Sync for Process
impl !UnwindSafe for Process
impl !RefUnwindSafe for Process
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
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>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
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>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self