pub trait ProcessMonitor: Send + Sync {
// Required methods
fn cpu_usage<'life0, 'async_trait>(
&'life0 self,
pid: u32,
) -> Pin<Box<dyn Future<Output = Layer3Result<f32>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn memory_usage<'life0, 'async_trait>(
&'life0 self,
pid: u32,
) -> Pin<Box<dyn Future<Output = Layer3Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn runtime<'life0, 'async_trait>(
&'life0 self,
pid: u32,
) -> Pin<Box<dyn Future<Output = Layer3Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set_limits<'life0, 'async_trait>(
&'life0 self,
pid: u32,
limits: ProcessLimits,
) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
进程监控 trait
Required Methods§
Sourcefn cpu_usage<'life0, 'async_trait>(
&'life0 self,
pid: u32,
) -> Pin<Box<dyn Future<Output = Layer3Result<f32>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn cpu_usage<'life0, 'async_trait>(
&'life0 self,
pid: u32,
) -> Pin<Box<dyn Future<Output = Layer3Result<f32>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
获取 CPU 使用率
Sourcefn memory_usage<'life0, 'async_trait>(
&'life0 self,
pid: u32,
) -> Pin<Box<dyn Future<Output = Layer3Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn memory_usage<'life0, 'async_trait>(
&'life0 self,
pid: u32,
) -> Pin<Box<dyn Future<Output = Layer3Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
获取内存使用
Sourcefn runtime<'life0, 'async_trait>(
&'life0 self,
pid: u32,
) -> Pin<Box<dyn Future<Output = Layer3Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn runtime<'life0, 'async_trait>(
&'life0 self,
pid: u32,
) -> Pin<Box<dyn Future<Output = Layer3Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
获取运行时间
Sourcefn set_limits<'life0, 'async_trait>(
&'life0 self,
pid: u32,
limits: ProcessLimits,
) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_limits<'life0, 'async_trait>(
&'life0 self,
pid: u32,
limits: ProcessLimits,
) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
设置资源限制
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".