Skip to content

Commit e7a9088

Browse files
tzstoyanovacmel
authored andcommitted
tools lib traceevent: Optimize pretty_print() function
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@gmail.com Link: http://lore.kernel.org/linux-trace-devel/20200625100516.365338-8-tz.stoyanov@gmail.com Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: linux-trace-devel@vger.kernel.org Link: http://lore.kernel.org/lkml/20200702185704.559785000@goodmis.org Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 487ae1f commit e7a9088

3 files changed

Lines changed: 495 additions & 197 deletions

File tree

‎tools/lib/traceevent/event-parse-local.h‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,23 @@ struct tep_handle {
8585
struct tep_plugins_dir *plugins_dir;
8686
};
8787

88+
enum tep_print_parse_type {
89+
PRINT_FMT_STING,
90+
PRINT_FMT_ARG_DIGIT,
91+
PRINT_FMT_ARG_POINTER,
92+
PRINT_FMT_ARG_STRING,
93+
};
94+
95+
struct tep_print_parse {
96+
struct tep_print_parse *next;
97+
98+
char *format;
99+
int ls;
100+
enum tep_print_parse_type type;
101+
struct tep_print_arg *arg;
102+
struct tep_print_arg *len_as_arg;
103+
};
104+
88105
void tep_free_event(struct tep_event *event);
89106
void tep_free_format_field(struct tep_format_field *field);
90107
void tep_free_plugin_paths(struct tep_handle *tep);

0 commit comments

Comments
 (0)