Struct Rusage

Source
#[repr(C)]
pub struct Rusage {
Show 16 fields pub utime: TimeVal, pub stime: TimeVal, pub maxrss: i64, pub ixrss: i64, pub idrss: i64, pub isrss: i64, pub minflt: i64, pub majflt: i64, pub nswap: i64, pub inblock: i64, pub oublock: i64, pub msgsnd: i64, pub msgrcv: i64, pub nsignals: i64, pub nvcsw: i64, pub nivcsw: i64,
}
Expand description

资源使用情况结构体(对应 C 的 struct rusage) 记录进程或线程的时间和资源消耗信息 MUSL: https://github.com/bminor/musl/blob/c47ad25ea3b484e10326f933e927c0bc8cded3da/include/sys/resource.h#L27

Fields§

§utime: TimeVal

用户态运行时间(单位:秒 + 微秒)

§stime: TimeVal

内核态运行时间(单位:秒 + 微秒)

§maxrss: i64

最大常驻集大小(单位:KB),即内存占用峰值

§ixrss: i64

索引页的使用数量(已废弃)

§idrss: i64

数据段内存使用量(已废弃)

§isrss: i64

堆栈段内存使用量(已废弃)

§minflt: i64

页面缺页异常数(软缺页,不涉及磁盘 IO)

§majflt: i64

主缺页异常数(硬缺页,需要从磁盘读取页面)

§nswap: i64

发生的交换(swap)次数

§inblock: i64

输入操作(块设备读取)的次数

§oublock: i64

输出操作(块设备写入)的次数

§msgsnd: i64

发送的 IPC 消息数(已废弃)

§msgrcv: i64

接收的 IPC 消息数(已废弃)

§nsignals: i64

捕获的信号数量

§nvcsw: i64

自愿上下文切换次数(如等待锁)

§nivcsw: i64

非自愿上下文切换次数(被内核抢占)

Auto Trait Implementations§

§

impl Freeze for Rusage

§

impl RefUnwindSafe for Rusage

§

impl Send for Rusage

§

impl Sync for Rusage

§

impl Unpin for Rusage

§

impl UnwindSafe for Rusage

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.