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

sapphire-arches avatar dylanede avatar akhilveeraghanta avatar hackattack avatar

Stargazers

Clément Fournier avatar Jiri Kastner avatar 聪 avatar zbv avatar Iqbal Rifai avatar Ammar Faizi avatar savi2w avatar Sora Morimoto avatar  avatar Tristan Hume avatar Rust avatar Jérémie Galarneau avatar Francis Deslauriers avatar

Watchers

Jiri Kastner avatar  avatar  avatar

lttng-ust-rs's Issues

depend on newer `bindgen` and release new version

Any chance that a new version could be released based on HEAD and pushed to cargo.io? Currently every time code is compiled that depends on this crate, the following warning is printed:

warning: the following packages contain code that will be rejected by a future version of Rust: nom v3.2.1

nom is an indirect dependency of bindgen -- does the version bump to bindgen address this?

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.