libtracefs: Allow filters to use "COMM"
PATCH 1/1 libtracefs: Allow filters to use "COMM"
From: "Steven Rostedt (Google)" <[email protected]>
COMM is a legitimate filter for events, histograms and synthetic events. Allow it to be used in tracefs_sql().
Signed-off-by Steven Rostedt (Google) <[email protected]>
--- src/tracefs-filter.c | 14 +++++++++++++- src/tracefs-sqlhist.c | 5 +++++ 2 files changed, 18 insertions(+), 1 deletion(-)
src/tracefs-filter.c +13 -1
@@ -35,6 +35,12 @@ static const struct tep_format_field common_timestamp_usecs = { .size = 8, }; +static const struct tep_format_field common_comm = { + .type ="char *" , + .name ="common_comm" , + .size =16 , +}; +/* * This also must be able to accept fields that are OK via the histograms, * such as common_timestamp.
@@ -42,13 +48,19 @@ static const struct tep_format_field common_timestamp_usecs = {static const struct tep_format_field *get_event_field (struct tep_event *event,const char *field_name) { +const struct tep_format_field *field; +if (!strcmp (field_name,TRACEFS_TIMESTAMP ))return &common_timestamp;if (!strcmp (field_name,TRACEFS_TIMESTAMP_USECS ))return &common_timestamp_usecs; -return tep_find_any_field (event, field_name); + field =tep_find_any_field (event, field_name); +if (!field && (!strcmp (field_name,"COMM" ) || !strcmp (field_name,"comm" ))) +return &common_comm; + +return field; }__hidden bool
src/tracefs-sqlhist.c +5 -0
@@ -572,6 +572,11 @@ static int test_field_exists(struct tep_handle *tep, tfield =tep_find_any_field (field->event, field_name);free (field_name); +if (!tfield && (!strcmp (field->field,"COMM" ) || !strcmp (field->field,"comm" ))) { +breakpoint (); + tfield = (void *)1L ; + } +if (tfield)return 0 ;
Signature · 1 line
2.35.1