[−][src]Struct heim_process::Process
System process.
Some extra methods can be found in the OS extensions
Implementations
impl Process
[src]
pub fn pid(&self) -> Pid
[src]
Returns the process pid.
pub async fn parent_pid<'_>(&'_ self) -> ProcessResult<Pid>
[src]
Returns process parent pid.
pub async fn parent<'_>(&'_ self) -> ProcessResult<Process>
[src]
Returns parent Process.
pub async fn name<'_>(&'_ self) -> ProcessResult<String>
[src]
Returns process name.
pub async fn exe<'_>(&'_ self) -> ProcessResult<PathBuf>
[src]
Returns process executable as an absolute path.
pub async fn command<'_>(&'_ self) -> ProcessResult<Command>
[src]
Returns process command line.
Example
let process = process::current().await?; let command = process.command().await?; println!("Command line arguments:"); for arg in &command { println!("{:?}", arg); }
pub async fn cwd<'_>(&'_ self) -> ProcessResult<PathBuf>
[src]
Returns process current working directory.
Compatibility
For Windows this method is not implemented yet and will always panic, see #105.
pub async fn status<'_>(&'_ self) -> ProcessResult<Status>
[src]
Returns current process status.
pub async fn environment<'_>(&'_ self) -> ProcessResult<Environment>
[src]
Returns process environment.
pub async fn create_time<'_>(&'_ self) -> ProcessResult<Time>
[src]
Returns process creation time, expressed as a Time amount since the UNIX epoch.
pub async fn cpu_time<'_>(&'_ self) -> ProcessResult<CpuTime>
[src]
Returns accumulated process time.
pub async fn cpu_usage<'_>(&'_ self) -> ProcessResult<CpuUsage>
[src]
Returns 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 async fn memory<'_>(&'_ self) -> ProcessResult<Memory>
[src]
Returns memory usage information for this process.
pub async fn is_running<'_>(&'_ self) -> ProcessResult<bool>
[src]
Checks if this Process
is still running.
pub async fn suspend<'_>(&'_ self) -> ProcessResult<()>
[src]
Suspends the current process.
Before the signal send, it checks whether process PID has been reused,
and if it is a case, NoSuchProcess
error will be returned.
Compatibility
For *nix systems it sends the SIGSTOP
signal to process.
pub async fn resume<'_>(&'_ self) -> ProcessResult<()>
[src]
Resumes the current process.
Before the signal send, it checks whether process PID has been reused,
and if it is a case, NoSuchProcess
error will be returned.
Compatibility
For *nix systems it sends the SIGCONT
signal to process.
pub async fn terminate<'_>(&'_ self) -> ProcessResult<()>
[src]
Terminates the current process.
Before the signal send, it checks whether process PID has been reused,
and if it is a case, NoSuchProcess
error will be returned.
Compatibility
For *nix systems it sends the SIGTERM
signal to process.
For Windows it is an alias for the Process::kill
pub async fn kill<'_>(&'_ self) -> ProcessResult<()>
[src]
Kills the current process.
Before the signal send, it checks whether process PID has been reused,
and if it is a case, NoSuchProcess
error will be returned.
Compatibility
For *nix systems it sends the SIGKILL
signal to process.
TerminateProcess
function is used for Windows,
it initiates the termination but does not awaits for completion.
pub async fn wait<'_>(&'_ self) -> ProcessResult<()>
[src]
Wait for the current process termination.
Returns
If the process is already terminated, this method returns Ok(())
.
pub async fn io_counters<'_>(&'_ self) -> ProcessResult<IoCounters>
[src]
Returns future which resolves into process IO counters.
Trait Implementations
impl Debug for Process
[src]
impl Eq for Process
[src]
impl Hash for Process
[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<Process> for Process
[src]
impl ProcessExt for Process
[src]
pub fn signal<'life0, 'async_trait>(
&'life0 self,
signal: Signal
) -> Pin<Box<dyn Future<Output = ProcessResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
signal: Signal
) -> Pin<Box<dyn Future<Output = ProcessResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
pub fn niceness<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = ProcessResult<c_int>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = ProcessResult<c_int>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
pub fn set_niceness<'life0, 'async_trait>(
&'life0 self,
value: c_int
) -> Pin<Box<dyn Future<Output = ProcessResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
value: c_int
) -> Pin<Box<dyn Future<Output = ProcessResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
impl ProcessExt for Process
[src]
pub fn net_io_counters<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = ProcessResult<BoxStream<'_, ProcessResult<IoCounters>>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = ProcessResult<BoxStream<'_, ProcessResult<IoCounters>>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
impl StructuralEq for Process
[src]
impl StructuralPartialEq for Process
[src]
Auto Trait Implementations
impl RefUnwindSafe for Process
[src]
impl Send for Process
[src]
impl Sync for Process
[src]
impl Unpin for Process
[src]
impl UnwindSafe for Process
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
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.
pub 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>,