• Stars
    star
    118
  • Rank 299,923 (Top 6 %)
  • Language
    Rust
  • License
    MIT License
  • Created over 2 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Low-overhead sampling profiler and tracer for Ruby for Linux

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

More Repositories

1

write-a-strace-and-gdb

Tiny system call tracer and debugger
C
110
star
2

sweeper

๐Ÿงน๐Ÿงน๐Ÿงน File expiration for any filesystem
Rust
45
star
3

emoji-prediction

๐Ÿค“๐Ÿ”ฎ๐Ÿ”ฌ Emoji prediction from a text using machine learning
Python
39
star
4

nebrija

A simple Ruby wrapper for the official Spanish dictionary (RAE)
Ruby
18
star
5

pghero

pghero python port
Python
11
star
6

ruby_perf_counters

Ruby gem to access the CPU performance counters (PMU) using perf_event_open(2)
Ruby
8
star
7

wheres-my-segfault

adds a backtrace & shows the line that caused a segfault of some native code
C
7
star
8

server_timing_middleware

Rack middleware that shows the Server Timing information using AS::Notifications
Ruby
7
star
9

tvvenn

Set operations โ€“ on twitter
Python
6
star
10

bookmark

Rust
6
star
11

traceur

Much ray. Very intersection. So phong. Wow.
JavaScript
6
star
12

dulcinea

A nebrija frontend + api.
HTML
5
star
13

toxisyscall

Rust
5
star
14

sptfy-tools

spotify hacks
Python
5
star
15

bpf-playground

Python
4
star
16

dragon

just an ast playground
C
3
star
17

corruption_monkey

๐Ÿ”ฌ๐Ÿ’๐Ÿ“
Ruby
3
star
18

lightswitch

Rust
3
star
19

unsafest_ruby

Run machine code from Ruby ๐Ÿ’ฃ๐Ÿ’Ž
C
2
star
20

linguist.py

Linguist wrapper-ish for Python
Python
2
star
21

ruby-vectorized-sum

Vectorized Fixnum array sum for ruby in C. Also, my first C extension for Ruby!
C
2
star
22

weekend-projects

afternoon weekend miniprojects
Ruby
1
star
23

uninterrumpible

Makefile
1
star
24

dat-turing-machine

A turing machine simulator. In js.
JavaScript
1
star
25

aalto-appetite

๐Ÿš Small utils to check Aalto university's cafeterias menus
Ruby
1
star
26

geostreamer

geostreamer
Ruby
1
star
27

aoc2021

Rust
1
star
28

erlearn

Erlang
1
star
29

pr-stats

Ruby
1
star