Skip to main content

ProcessMonitor

Trait ProcessMonitor 

Source
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§

Source

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 使用率

Source

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,

获取内存使用

Source

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,

获取运行时间

Source

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".

Implementors§