aboutsummaryrefslogtreecommitdiff
path: root/contrib/tracing/log_p2p_traffic.bt
blob: 89e5b777be98d512955cde681eaa12e5d90979d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env bpftrace

BEGIN
{
  printf("Logging P2P traffic\n")
}

usdt:./build/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:./build/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);
}