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
Reviewers: #bitcoin_abc, PiRK
Reviewed By: #bitcoin_abc, PiRK
Subscribers: PiRK
Differential Revision: https://reviews.bitcoinabc.org/D12623