Skip to content
Inject USDT probes into rust code
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
demo
doc
src
.gitignore
.travis.yml
Cargo.lock
Cargo.toml
README.md

README.md

rust-usdt

Inject USDT probes into rust code. Requires nightly.

Based on work done by Josh Stone [https://github.com/cuviper/rust-libprobe]

Build status

For more details, see documentation

Usage:

Cargo.toml:

[dependencies.rust-usdt]
git = "https://github.com/Fiedzia/rust-usdt"

in src/main.rs (as example, but you can insert probes in any place in your code)

#![feature(asm)]
#![feature(plugin)]
#![plugin(rust_usdt)]


fn main() {
    let a = 0i64;
	let b = 1i64;
    static_probe!(provider="foo", name="bar"; a,  i64, b, i64);
}

compile:

cargo build

Make sure probes were generated:

readelf -n ./target/debug/demo | grep NT_STAPSDT -A 4
  stapsdt              0x00000048       NT_STAPSDT (SystemTap probe descriptors)
    Provider: foo
    Name: bar
    Location: 0x000000000000741b, Base: 0x000000000003dc21, Semaphore: 0x0000000000000000
    Arguments: 8@-281(%rbp) 8@-289(%rbp)

Run bcc trace to trace them:

sudo /usr/share/bcc/tools/trace 'u:/home/maciej/git/rust-usdt/demo/demo1/target/debug/usdt_demo:bar "%d", arg1' 

PID    TID    COMM         FUNC             -
8163   8163   demo         bar              0

(you will need to run your app in separate terminal window to see the results)

You can’t perform that action at this time.