linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Yunhui Cui <cuiyunhui@bytedance.com>
Cc: mhiramat@kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, kuniyu@amazon.com,
	xiyou.wangcong@gmail.com, duanxiongchun@bytedance.com,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	netdev@vger.kernel.org, dust.li@linux.alibaba.com
Subject: Re: [PATCH v6] sock: add tracepoint for send recv length
Date: Thu, 12 Jan 2023 15:24:07 -0500	[thread overview]
Message-ID: <20230112152407.7acad054@gandalf.local.home> (raw)
In-Reply-To: <20230111065930.1494-1-cuiyunhui@bytedance.com>

On Wed, 11 Jan 2023 14:59:30 +0800
Yunhui Cui <cuiyunhui@bytedance.com> wrote:

> Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
> Signed-off-by: Xiongchun Duan <duanxiongchun@bytedance.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@goodmis.org>

-- Steve

  reply	other threads:[~2023-01-12 20:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-11  6:59 [PATCH v6] sock: add tracepoint for send recv length Yunhui Cui
2023-01-12 20:24 ` Steven Rostedt [this message]
2023-01-13 19:48 ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230112152407.7acad054@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=cuiyunhui@bytedance.com \
    --cc=davem@davemloft.net \
    --cc=duanxiongchun@bytedance.com \
    --cc=dust.li@linux.alibaba.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).