* [PATCH v2] libtracefs: Allow filters to use "COMM"
@ 2022-10-21 18:58 Steven Rostedt
0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2022-10-21 18:58 UTC (permalink / raw)
To: Linux Trace Devel
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
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) <rostedt@goodmis.org>
---
Changes since v1: https://lore.kernel.org/all/20221020193336.3070b37e@gandalf.local.home/
- Removed "breakpoint()" call that was left over from debugging
src/tracefs-filter.c | 14 +++++++++++++-
src/tracefs-sqlhist.c | 3 +++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/tracefs-filter.c b/src/tracefs-filter.c
index b16dfadb3aa9..a3dd77b7c82c 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 fd0a4b390855..3f571b7fa86a 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;
--
2.35.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-10-21 18:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-21 18:58 [PATCH v2] libtracefs: Allow filters to use "COMM" Steven Rostedt
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).