bpftrace is a Linux tracing language and CLI that uses eBPF for kernel and user-space dynamic tracing.
Overview
bpftrace is a general-purpose tracing tool and high-level language for Linux. It uses eBPF to run efficient observability programs with low overhead, and is aimed at people who want concise scripts rather than low-level BPF programming.
The toolchain compiles bpftrace programs with LLVM and talks to the Linux BPF subsystem through libbpf. It supports kernel dynamic tracing with kprobes and perf events, user-space tracing with uprobes and USDT, tracepoints, and related probe types. The language takes cues from awk, C, and earlier tracers such as DTrace and SystemTap.
You can install bpftrace from many distribution package managers or use published binary archives. The project site hosts documentation, a one-liner tutorial, community channels, and examples of tools built with bpftrace.
Canonical example tools ship with bpftrace, and contributors can submit user-built tools to a separate user-tools project.
Key features
- eBPF-backed Linux tracing
- High-level bpftrace scripting language
- kprobes, uprobes, USDT, and tracepoints
- LLVM compilation backend
- Distribution package installations
- Documentation and tutorial material
- Canonical and community tool examples
Use cases
- Ad hoc kernel and user-space diagnosis on Linux
- Writing short live tracing one-liners
- Production observability with custom bpftrace scripts
- Learning eBPF tracing without manual BPF bytecode