Skip to content

bvaisvil/linux-taskstats-rs

 
 

Repository files navigation

linux-taskstats-rs

Rust interface to Linux's taskstats.

This crate provides access to taskstats which is known as a way to access task's "delay" information a.k.a Delay Accounting.

Usage

use linux_taskstats::{self, Delays, Client};

fn get_thread_delays(pid: u32) -> Result<Delays, linux_taskstats::Error> {
    let client = Client::open()?;
    let ts = client.pid_stats(pid)?;
    Ok(ts.delays)
}

fn get_process_delays(pid: u32) -> Result<Delays, linux_taskstats::Error> {
    let client = Client::open()?;
    let ts = client.tgid_stats(pid)?;
    Ok(ts.delays)
}

How to build

cargo test
cargo build

Or on platform other than linux:

./docker-build/build-docker-image.sh # Just once, creates a image `taskstats-build:latest`
./docker-build/build.sh
# The outputs will be created under docker-build/target

License

MIT

About

Rust interface for Linux taskstats

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 95.6%
  • Shell 4.0%
  • Other 0.4%