Backporting BCC & bpftrace
I'm following Brendan Gregg's performance-related content for years now. I started when he was still in Joyent, later on I bought his Systems Performance book and I get back to it whenever I'm doing any profiling. Now I follow closely all of the latest work he's doing on BPF front. There's a small problem though. On the dependency tree of production-grade systems, I've got the following:
- stable OS (Debian 10 "Buster" or Ubuntu 18.04 "Bionic Beaver")
- latest kernel (5.0+)
- latest tracing tools (BCC & bpftrace)
Two first are easy -- both Debian and Ubuntu are now providing ways for having relatively new kernel up and running -- former with buster-backports[1] and latter with HWE.[2] The third one becomes a small hassle, at least in Ubuntu world.
bpftrace is currently not available for bionic at all. There's no technical limitation here -- it's just the package was never built for it.[3] I decided to backport it then.
googletest
First thing to bump up turned out to be googletest package. 18.04 has it in its repositories, but it's one minor version lower than "oldstable",[4] which is available on 19.04+. The package is now in the ppa:hadret/googletest
and, if necessary, can be easily pulled in:
sudo add-apt-repository ppa:hadret/googletest
sudo apt-get update
Having this in place, I was ready to build latest bpftrace
. However, I decided to first bump up also BCC.
BCC
bpfcc packages are quite old for anything lower than 20.04.[5] I went ahead and backported bcc 0.12.0[6] and libbpf 0.0.6 -- it's available for bionic, disco (19.04) and eoan (19.10). It can be installed separately from the following PPA:
sudo add-apt-repository ppa:hadret/bpfcc
sudo apt-get update
sudo apt-get install bpfcc-tools
It can also be installed from the bpftrace PPA, read on below.
bpftrace
bpftrace is missing entirely for bionic and all the rest is slightly behind the current stable. I backported latest stable release from November: 0.9.3. I built it for bionic, disco & eoan and it's available from the following PPA:
sudo add-apt-repository ppa:hadret/bpftrace
sudo apt-get update
sudo apt-get install bpftrace
I also copied BCC packages to this repository, so that this last PPA is the only one necessary to have latest versions for BCC and bpftrace (regardless of whether you are running 18.04, 19.04 or 19.10). I'll try to keep these up to date as I have personal interest in playing with the latest versions of these tools 😉
Summary
Should you look for inspiration on what to do next with them, now that latest versions are available, be sure to check this out: Linux Extended BPF (eBPF) Tracing Tools. Next stop might be BPF Performance Tools (book) -- it definitely is for me!
Discussion