Giter Site home page Giter Site logo

lttng-ust-rs's Introduction

LTTNG-UST-RS

This is a collection of crates which provide bindings to lttng-ust (Linux Trace Toolkit Next Generation - User Space Tracing). lttng-ust is a low-overhead Linux usespace tracing framework with 10+ years of open source development. This project aims to leverage all of that work to allow for low-overhead tracing of Rust applications under Linux.

Note for non-Linux users

Due to the nature of LTTNG, this crate is unlikely to work on non-Linux systems ;). I am interested in writing a more general pure-Rust tracing framework but that is a much more involved undertaking, and I'd like to get this crate polished first.

Basic usage

Add the following to your Cargo.toml:

[dependencies]
lttng-ust = "0.1.0"

[build-dependencies]
lttng-ust-generate = "0.1.0"

And make sure you run something like this in your build.rs:

use std::env;
use std::path::PathBuf;

use lttng_ust_generate::{Provider, Generator, CTFType, CIntegerType};

let mut provider = Provider::new("my_first_rust_provider"); // stage 1
provider.create_class("my_first_class") //stage 2
    .add_field("my_integer_field", CTFType::Integer(CIntegerType::I32))
    .add_field("my_string_field", CTFType::SequenceText)
    .instantiate("my_first_tracepoint"); // stage 3

Generator::default()
    .generated_lib_name("tracepoint_library_link_name")
    .register_provider(provider)
    .output_file_name(PathBuf::from(env::var("OUT_DIR").unwrap()).join("tracepoints.rs"))
    .generate()
    .expect("Unable to generate tracepoint bindings");

And finally, use your brand new tracepoint!

extern crate lttng_ust;

import_tracepoints!(
    concat!(env!("OUT_DIR"), "/tracepoints.rs"),
    tracepoints
);

fn main() {
    tracepoints::my_first_rust_provider::my_first_tracepoint(42, "the meaning of life");
}

For more detailed documentation and examples, see the module docs for lttng-ust-generate and the examples/ documentation.

lttng-ust-rs's People

Contributors

dylanede avatar sapphire-arches avatar skoudmar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.