10 unstable releases (4 breaking)

0.6.0 Apr 4, 2024
0.5.0 Mar 1, 2024
0.4.0 Jan 21, 2023
0.2.1 Nov 18, 2022
0.1.3 May 27, 2020

#36 in #access

Download history 1/week @ 2023-12-31 1/week @ 2024-02-04 16/week @ 2024-02-18 184/week @ 2024-02-25 49/week @ 2024-03-03 69/week @ 2024-03-10 22/week @ 2024-03-17 59/week @ 2024-03-24 179/week @ 2024-03-31 31/week @ 2024-04-07 14/week @ 2024-04-14

289 downloads per month

MIT license

58KB
1.5K SLoC

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

Dependencies

~3–16MB
~173K SLoC