Re: [PATCH v2 07/15] tools lib traceevent: Optimize pretty_print() function

From: Namhyung Kim
Date: Tue Jul 07 2020 - 11:11:30 EST


On Fri, Jul 3, 2020 at 3:57 AM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@xxxxxxxxx>
>
> Each time the pretty_print() function is called to print an event,
> the event's format string is parsed. As this format string does not
> change, this parsing can be done only once - when the event struct
> is initialized.
>
> Link: https://lore.kernel.org/linux-trace-devel/20200529134929.537110-1-tz.stoyanov@xxxxxxxxx
> Link: http://lore.kernel.org/linux-trace-devel/20200625100516.365338-8-tz.stoyanov@xxxxxxxxx
>
> Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@xxxxxxxxx>
> Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
> ---
> tools/lib/traceevent/event-parse-local.h | 17 +
> tools/lib/traceevent/event-parse.c | 672 ++++++++++++++++-------
> tools/lib/traceevent/event-parse.h | 3 +
> 3 files changed, 495 insertions(+), 197 deletions(-)
>
> diff --git a/tools/lib/traceevent/event-parse-local.h b/tools/lib/traceevent/event-parse-local.h
> index 96a0b0ca0675..e71296a62236 100644
> --- a/tools/lib/traceevent/event-parse-local.h
> +++ b/tools/lib/traceevent/event-parse-local.h
> @@ -85,6 +85,23 @@ struct tep_handle {
> struct tep_plugins_dir *plugins_dir;
> };
>
> +enum tep_print_parse_type {
> + PRINT_FMT_STING,

STRING ?

> + PRINT_FMT_ARG_DIGIT,
> + PRINT_FMT_ARG_POINTER,
> + PRINT_FMT_ARG_STRING,
> +};