Skip to content

Commit

Permalink
add tcp_sendpage for tcptop tool
Browse files Browse the repository at this point in the history
  • Loading branch information
jackygam2001 authored and yonghong-song committed Apr 26, 2022
1 parent d5da88c commit 2c389db
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tools/tcptop.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ def range_check(string):
BPF_HASH(ipv6_send_bytes, struct ipv6_key_t);
BPF_HASH(ipv6_recv_bytes, struct ipv6_key_t);
int kprobe__tcp_sendmsg(struct pt_regs *ctx, struct sock *sk,
struct msghdr *msg, size_t size)
static int tcp_sendstat(struct sock *sk, size_t size)
{
if (container_should_be_filtered()) {
return 0;
Expand Down Expand Up @@ -152,6 +151,17 @@ def range_check(string):
return 0;
}
int kprobe__tcp_sendmsg(struct pt_regs *ctx, struct sock *sk,
struct msghdr *msg, size_t size)
{
return tcp_sendstat(sk, size);
}
int kprobe__tcp_sendpage(struct pt_regs *ctx, struct sock *sk,
struct page *page, int offset, size_t size)
{
return tcp_sendstat(sk, size);
}
/*
* tcp_recvmsg() would be obvious to trace, but is less suitable because:
* - we'd need to trace both entry and return, to have both sock and size
Expand Down

0 comments on commit 2c389db

Please sign in to comment.