aboutsummaryrefslogtreecommitdiff
path: root/contrib/tracing/log_p2p_traffic.bt
blob: f62956aa5e1c3d36844c762b620ec4d43f9ee764 (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:./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);
}