bpftrace is a powerful tracing tool for Red Hat Enterprise Linux systems that uses extended Berkeley Packet Filter (eBPF) technology. With bpftrace, you can trace and analyze kernel and user-space events dynamically without modifying the kernel code.
Procedure
-
Install the
bpftrace package:
$ sudo dnf install bpftrace
-
Run the test:
$ sudo bpftrace -e 'tracepoint:raw_syscalls:sys_enter { @ = count(); } interval:s:1 { print(@); clear(@); }'
This command displays a high-level overview of system activity by observing the rate of system calls made.
You are now ready to use bpftrace. You can explore example scripts located at /usr/share/bpftrace/tools/, learn scripts online or create your own scripts to trace events and analyze system behavior.