[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230112152407.7acad054@gandalf.local.home>
Date: Thu, 12 Jan 2023 15:24:07 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Yunhui Cui <cuiyunhui@...edance.com>
Cc: mhiramat@...nel.org, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, kuniyu@...zon.com,
xiyou.wangcong@...il.com, duanxiongchun@...edance.com,
linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
netdev@...r.kernel.org, dust.li@...ux.alibaba.com
Subject: Re: [PATCH v6] sock: add tracepoint for send recv length
On Wed, 11 Jan 2023 14:59:30 +0800
Yunhui Cui <cuiyunhui@...edance.com> wrote:
> Signed-off-by: Yunhui Cui <cuiyunhui@...edance.com>
> Signed-off-by: Xiongchun Duan <duanxiongchun@...edance.com>
> ---
> include/trace/events/sock.h | 45 +++++++++++++++++++++++++++++++++++++
> net/socket.c | 33 +++++++++++++++++++++++----
> 2 files changed, 74 insertions(+), 4 deletions(-)
>
> diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h
> index 777ee6cbe933..71492e8276da 100644
> --- a/include/trace/events/sock.h
> +++ b/include/trace/events/sock.h
> @@ -263,6 +263,51 @@ TRACE_EVENT(inet_sk_error_report,
> __entry->error)
> );
>
> +/*
> + * sock send/recv msg length
> + */
> +DECLARE_EVENT_CLASS(sock_msg_length,
> +
> + TP_PROTO(struct sock *sk, int ret, int flags),
> +
> + TP_ARGS(sk, ret, flags),
> +
> + TP_STRUCT__entry(
> + __field(void *, sk)
> + __field(__u16, family)
> + __field(__u16, protocol)
> + __field(int, ret)
> + __field(int, flags)
> + ),
> +
> + TP_fast_assign(
> + __entry->sk = sk;
> + __entry->family = sk->sk_family;
> + __entry->protocol = sk->sk_protocol;
> + __entry->ret = ret;
> + __entry->flags = flags;
> + ),
> +
> + TP_printk("sk address = %p, family = %s protocol = %s, length = %d, error = %d, flags = 0x%x",
> + __entry->sk, show_family_name(__entry->family),
> + show_inet_protocol_name(__entry->protocol),
> + !(__entry->flags & MSG_PEEK) ?
> + (__entry->ret > 0 ? __entry->ret : 0) : 0,
> + __entry->ret < 0 ? __entry->ret : 0,
> + __entry->flags)
> +);
> +
> +DEFINE_EVENT(sock_msg_length, sock_send_length,
> + TP_PROTO(struct sock *sk, int ret, int flags),
> +
> + TP_ARGS(sk, ret, flags)
> +);
> +
> +DEFINE_EVENT(sock_msg_length, sock_recv_length,
> + TP_PROTO(struct sock *sk, int ret, int flags),
> +
> + TP_ARGS(sk, ret, flags)
> +);
>From the tracing POV:
Reviewed-by: Steven Rostedt (Google) <rostedt@...dmis.org>
-- Steve
Powered by blists - more mailing lists