dtrace

Crates.iodtrace
lib.rsdtrace
version0.1.1
created_at2024-12-23 09:21:19.335751+00
updated_at2024-12-23 09:27:29.223253+00
descriptionRust-like bindings to dtrace
homepage
repositoryhttps://github.com/xiaopengli89/dtrace-rs
max_upload_size
id1492888
size667,439
Xiaopeng Li (xiaopengli89)

documentation

README

dtrace

Rust-like bindings to dtrace.

let pid = 1324;
let mut dt = dtrace::Dtrace::new().unwrap();
dt.setopt_c(c"strsize", c"4096").unwrap();
dt.setopt_c(c"bufsize", c"4m").unwrap();
dt.exec_program(&format!(
    r#"pid{}::__exit:entry{{printf("exit"); exit(0)}}"#,
    pid
))
.unwrap();
dt.go().unwrap();

println!("waiting for exit...");
while let Ok(false) = dt.work(|output| {
    println!(">> {output}");
}) {}
dt.stop().unwrap();
Commit count: 5

cargo fmt