diff options
author | 0xb10c <0xb10c@gmail.com> | 2021-05-20 16:54:54 +0200 |
---|---|---|
committer | 0xb10c <0xb10c@gmail.com> | 2021-07-27 17:12:16 +0200 |
commit | 4224dec22baa66547303840707cf1d4f15a49b20 (patch) | |
tree | 467d8bc70b3a3d3ada1fc4a2281ff2725031f09d /contrib/tracing/log_p2p_traffic.bt | |
parent | 469b71ae629228b2591a55831817a0e5fad89360 (diff) | |
download | bitcoin-4224dec22baa66547303840707cf1d4f15a49b20.tar.xz |
tracing: Tracepoints for in- and outbound P2P msgs
Can be used to monitor in- and outbound node traffic.
Based on ealier work by jb55.
Co-authored-by: William Casarin <jb55@jb55.com>
Diffstat (limited to 'contrib/tracing/log_p2p_traffic.bt')
-rwxr-xr-x | contrib/tracing/log_p2p_traffic.bt | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/contrib/tracing/log_p2p_traffic.bt b/contrib/tracing/log_p2p_traffic.bt new file mode 100755 index 0000000000..f62956aa5e --- /dev/null +++ b/contrib/tracing/log_p2p_traffic.bt @@ -0,0 +1,28 @@ +#!/usr/bin/env bpftrace + +BEGIN +{ + printf("Logging P2P traffic\n") +} + +usdt:./src/bitcoind:net:inbound_message +{ + $peer_id = (int64) arg0; + $peer_addr = str(arg1); + $peer_type = str(arg2); + $msg_type = str(arg3); + $msg_len = arg4; + printf("inbound '%s' msg from peer %d (%s, %s) with %d bytes\n", $msg_type, $peer_id, $peer_type, $peer_addr, $msg_len); +} + +usdt:./src/bitcoind:net:outbound_message +{ + $peer_id = (int64) arg0; + $peer_addr = str(arg1); + $peer_type = str(arg2); + $msg_type = str(arg3); + $msg_len = arg4; + + printf("outbound '%s' msg to peer %d (%s, %s) with %d bytes\n", $msg_type, $peer_id, $peer_type, $peer_addr, $msg_len); +} + |