Struct linux_taskstats::Client
source · pub struct Client { /* private fields */ }
Expand description
Interface to access kernel taskstats API through the netlink socket.
Implementations§
source§impl Client
impl Client
sourcepub fn open() -> Result<Self>
pub fn open() -> Result<Self>
Open netlink socket against kernel and create a new instance of Client
Errors
- when netlink socket initialization failed
- when kernel doesn’t offer family id for taskstats
sourcepub fn pid_stats(&self, tid: u32) -> Result<TaskStats>
pub fn pid_stats(&self, tid: u32) -> Result<TaskStats>
Obtain taskstats for given task ID (e.g. single thread of a multithreaded process)
Arguments
tid
- Kernel task ID (“pid”, “tid” and “task” are used interchangeably and refer to the standard Linux task defined by struct task_struct)
Return
TaskStats
storing the target task’s stats
Errors
- when netlink socket failed
- when kernel responded error
- when the returned data couldn’t be interpreted
sourcepub fn tgid_stats(&self, tgid: u32) -> Result<TaskStats>
pub fn tgid_stats(&self, tgid: u32) -> Result<TaskStats>
Obtain taskstats for given thread group ID (e.g. cumulated statistics of a multithreaded process)
Arguments
tgid
- Kernel thread group ID (“tgid”, “process” and “thread group” are used interchangeably and refer to the traditional Unix process)
Return
TaskStats
storing the target thread group’s aggregated stats
Errors
- when netlink socket failed
- when kernel responded error
- when the returned data couldn’t be interpreted