Giter Site home page Giter Site logo

javierhonduco / rbperf Goto Github PK

View Code? Open in Web Editor NEW
116.0 10.0 5.0 1.95 MB

Low-overhead sampling profiler and tracer for Ruby for Linux

License: MIT License

Shell 2.54% C 16.29% Ruby 1.18% Rust 77.25% Just 0.97% Nix 1.76%
ruby bpf performance profilers flamegraph tracer

rbperf's Introduction

rbperf

rbperf is a low-overhead sampling profiler and tracer for Ruby (CRuby) which runs in BPF

Features

The main goals for rbperf are

  • On-CPU profiling support
  • Low overhead
  • Profiled processes don't have to be restarted or modified in any way
  • Support for tracing low level events, such as system calls

Installation

The latest release of is available here.

Usage

CPU sampling

$ sudo rbperf record --pid `pidof ruby` cpu

System call tracing

The available system calls to trace can be found with:

$ sudo rbperf record --pid `pidof ruby` syscall --list
$ sudo rbperf record --pid `pidof ruby` syscall enter_writev

Some debug information will be printed, and a flamegraph called rbperf_flame_$date will be written to disk ๐ŸŽ‰

Supported Ruby versions

The currently supported Ruby versions:

  • 2.6: 2.6.0, 2.6.3
  • 2.7: 2.7.1, 2.7.4, 2.7.6
  • 3.x: 3.0.0, 3.0.4, 3.1.2, 3.1.3, 3.2.0, 3.2.1

Supported kernels

Linux kernel 4.18 is the minimum required version but 5.x and greater is recommended.

Building

To build rbperf you would need a modern Linux machine with:

  • The Rust toolchain
  • clang to compile the BPF code
  • elfutils and zlib installed
  • make and pkg-config to build libbpf

Once the dependencies are installed:

# As we are statically linking elfutils and zlib, we have to tell Rustc
# where are they located. On my Ubuntu system they are under
$ export RUSTFLAGS='-L /usr/lib/x86_64-linux-gnu'
$ cargo build [--release]

The built binary can be found under target/(debug|release)/rbperf.

Developing and troubleshooting

Debug logs can be enabled with RUST_LOG=debug. The info subcommand, rbperf info shows the supported BPF features as well as other supported details.

Stability

rbperf is in active development and the CLI and APIs might change any time

Bugs

If you encounter any bugs, feel free to open an issue on rbperf's repo

Acknowledgements

rbperf wouldn't be possible without all the open source projects that we benefit from, such as Rust and all the superb crates we use in this project, Ruby and its GDB file, the BPF ecosystem, and many others!

License

Licensed under the MIT license

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.