Page MenuHomePhabricator

eBPF Linux tracepoints
ClosedPublic

Authored by Fabien on Nov 25 2022, 10:49.

Details

Reviewers
PiRK
Group Reviewers
Restricted Project
Commits
rABCabafc354a093: eBPF Linux tracepoints
Summary
Instead of writing ad-hoc logging everywhere (eg: #19509), we can take advantage of linux user static defined traces, aka. USDTs ( not the stablecoin sweat_smile )

The linux kernel can hook into these tracepoints at runtime, but otherwise they have little to no performance impact. Traces can pass data which can be printed externally via tools such as bpftrace. For example, here's one that prints incoming and outgoing network messages:

Backport of core#19866.

This PR adds documentation for User-Space, Statically Defined Tracing (USDT) as well as three tracepoints (including documentation and usage examples).

Backport of core#22006.

Test Plan
cmake -GNinja .. -DENABLE_TRACING=ON
ninja
./src/bitcoind -daemon
sudo bpftrace ../contrib/tracing/log_p2p_traffic.bt
sudo ../contrib/tracing/p2p_monitor.py ./src/bitcoind

Event Timeline

Fabien requested review of this revision.Nov 25 2022, 10:49
PiRK added a subscriber: PiRK.

nit: test plan needs ninja

This revision is now accepted and ready to land.Nov 25 2022, 13:31
This revision was automatically updated to reflect the committed changes.