第28章 Analyzing system performance with eBPF
You can use the bfptrace and BPF Compiler Collection (BCC) library to create tools for analyzing the performance of your Linux operating system and gathering information, which might be difficult to obtain through other interfaces.
28.1. Using the bpftrace package リンクのコピーリンクがクリップボードにコピーされました!
bpftrace is a powerful tracing tool for RHEL systems by using the eBPF technology. You can dynamically trace and analyze kernel and user-space events without modifying the kernel code.
Procedure
Install the
bpftracepackage:$ sudo dnf install bpftraceRun 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.