From: Steven Rostedt <rostedt@goodmis.org>
To: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH v6 5/5] libtraceevent: Add tep_print_selected_fields()
Date: Thu, 19 Aug 2021 12:55:09 -0400 [thread overview]
Message-ID: <20210819125510.0b0b04c2@oasis.local.home> (raw)
In-Reply-To: <20210812085929.54832-6-y.karadz@gmail.com>
On Thu, 12 Aug 2021 11:59:29 +0300
"Yordan Karadzhov (VMware)" <y.karadz@gmail.com> wrote:
> The new method can print only a subset of the unique data fields of
> the trace event. The print format is derived from the parsing tokens
> (tep_print_parse objects) of the event.
>
> Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
> ---
> src/event-parse.c | 26 ++++++++++++++++++++++----
> src/event-parse.h | 3 +++
> 2 files changed, 25 insertions(+), 4 deletions(-)
>
> diff --git a/src/event-parse.c b/src/event-parse.c
> index 0795135..645506e 100644
> --- a/src/event-parse.c
> +++ b/src/event-parse.c
> @@ -5455,20 +5455,38 @@ void tep_print_field(struct trace_seq *s, void *data,
> _tep_print_field(s, data, field, NULL);
> }
>
> -void tep_print_fields(struct trace_seq *s, void *data,
> - int size __maybe_unused, struct tep_event *event)
> +static inline void
> +print_selected_fields(struct trace_seq *s, void *data,
> + struct tep_event *event,
> + unsigned long long ignore_mask)
> {
> struct tep_print_parse *parse = event->print_fmt.print_cache;
> struct tep_format_field *field;
> + unsigned long long field_mask = 1;
>
> field = event->format.fields;
> - while (field) {
> + for (;field; field = field->next, field_mask *= 2) {
The above should be:
for(; field; field = field->next, field_mask <<= 1) {
As a shift should be done with a shift operator and not a
multiplication.
Other than that, the rest looks good. I'll go ahead and pull in patches
1 and 2.
-- Steve
> + if (field_mask & ignore_mask)
> + continue;
> +
> trace_seq_printf(s, " %s=", field->name);
> _tep_print_field(s, data, field, &parse);
> - field = field->next;
> }
> }
>
> +void tep_print_selected_fields(struct trace_seq *s, void *data,
As the above is an API, it needs a kernel doc type comment, and also an
addition to the man pages. The man page may be a separate patch.
-- Steve
> + struct tep_event *event,
> + unsigned long long ignore_mask)
> +{
> + print_selected_fields(s, data, event, ignore_mask);
> +}
> +
> +void tep_print_fields(struct trace_seq *s, void *data,
> + int size __maybe_unused, struct tep_event *event)
> +{
> + print_selected_fields(s, data, event, 0);
> +}
> +
> static int print_function(struct trace_seq *s, const char *format,
> void *data, int size, struct tep_event *event,
> struct tep_print_arg *arg)
> diff --git a/src/event-parse.h b/src/event-parse.h
> index d4a876f..e3638cf 100644
> --- a/src/event-parse.h
> +++ b/src/event-parse.h
> @@ -545,6 +545,9 @@ int tep_cmdline_pid(struct tep_handle *tep, struct tep_cmdline *cmdline);
>
> void tep_print_field(struct trace_seq *s, void *data,
> struct tep_format_field *field);
> +void tep_print_selected_fields(struct trace_seq *s, void *data,
> + struct tep_event *event,
> + unsigned long long ignore_mask);
> void tep_print_fields(struct trace_seq *s, void *data,
> int size __maybe_unused, struct tep_event *event);
> int tep_strerror(struct tep_handle *tep, enum tep_errno errnum,
next prev parent reply other threads:[~2021-08-19 16:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-12 8:59 [PATCH v6 0/5] libtraceevent: Optimize the print of tep fields Yordan Karadzhov (VMware)
2021-08-12 8:59 ` [PATCH v6 1/5] libtraceevent: Add dynamic_offset() Yordan Karadzhov (VMware)
2021-08-12 8:59 ` [PATCH v6 2/5] libtraceevent: Have all field args point to the field they represent Yordan Karadzhov (VMware)
2021-08-12 8:59 ` [PATCH v6 3/5] libtraceevent: Improve tep_print_field() Yordan Karadzhov (VMware)
2021-08-19 16:48 ` Steven Rostedt
2021-08-12 8:59 ` [PATCH v6 4/5] libtraceevent: Optimize tep_print_fields() Yordan Karadzhov (VMware)
2021-08-19 16:49 ` Steven Rostedt
2021-08-12 8:59 ` [PATCH v6 5/5] libtraceevent: Add tep_print_selected_fields() Yordan Karadzhov (VMware)
2021-08-19 16:55 ` Steven Rostedt [this message]
2021-08-20 13:36 ` Yordan Karadzhov
2021-08-20 14:35 ` Steven Rostedt
2021-08-20 15:05 ` Yordan Karadzhov
2021-08-20 16:01 ` Steven Rostedt
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=20210819125510.0b0b04c2@oasis.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
--cc=y.karadz@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).