diff options
author | Steven Rostedt (Google) <rostedt@goodmis.org> | 2022-10-21 14:58:28 -0400 |
---|---|---|
committer | Steven Rostedt (Google) <rostedt@goodmis.org> | 2022-10-25 14:21:06 -0400 |
commit | 9098ab0d2ef4be14a0b54dc40bc4a4fea5df5da8 (patch) | |
tree | 523b0fb45eaa1490be756f5a0f58b0a22e52a51e | |
parent | 7e3301f6403c1bea0b740a84f1746e9ddc270496 (diff) | |
download | libtracefs-9098ab0d2ef4be14a0b54dc40bc4a4fea5df5da8.tar.gz |
libtracefs: Allow filters to use "COMM"
COMM is a legitimate filter for events, histograms and synthetic events.
Allow it to be used in tracefs_sql().
Link: https://lore.kernel.org/linux-trace-devel/20221021145828.68d05371@gandalf.local.home
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-rw-r--r-- | src/tracefs-filter.c | 14 | ||||
-rw-r--r-- | src/tracefs-sqlhist.c | 3 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/tracefs-filter.c b/src/tracefs-filter.c index b16dfad..a3dd77b 100644 --- a/src/tracefs-filter.c +++ b/src/tracefs-filter.c @@ -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 diff --git a/src/tracefs-sqlhist.c b/src/tracefs-sqlhist.c index fd0a4b3..3f571b7 100644 --- a/src/tracefs-sqlhist.c +++ b/src/tracefs-sqlhist.c @@ -572,6 +572,9 @@ 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"))) + tfield = (void *)1L; + if (tfield) return 0; |