linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Cc: hws@denx.de
Subject: [PATCH] libtracefs: Have labels in selections be synthetic fields
Date: Wed, 1 Jun 2022 06:26:19 -0400	[thread overview]
Message-ID: <20220601062619.2f601c8a@rorschach.local.home> (raw)

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

The labels in the selection case are suppose to be the fields for the
created synthetic events. But for some reason they were ignored.

For example:

  sqlhist -n wakeup_lat 'select end.next_pid as pid, end.next_comm as comm, (end.TIMESTAMP - start.TIMESTAMP) as lat
   from sched_waking as start join sched_switch as end on start.pid = end.next_pid'

Produces the synthetic event of:

  echo 'wakeup_lat pid_t next_pid; char next_comm[16]; u64 lat;' >> /sys/kernel/tracing/synthetic_events

Where it should have used 'pid' instead of 'next_pid' and 'comm' instead
of 'next_comm'

Fixes: 25446407 ("libtracefs: Added new API tracefs_sql()")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 src/tracefs-sqlhist.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/tracefs-sqlhist.c b/src/tracefs-sqlhist.c
index 9811362..8d71800 100644
--- a/src/tracefs-sqlhist.c
+++ b/src/tracefs-sqlhist.c
@@ -253,6 +253,7 @@ __hidden int add_selection(struct sqlhist_bison *sb, void *select,
 
 	switch (expr->type) {
 	case EXPR_FIELD:
+		expr->field.label = name;
 		break;
 	case EXPR_COMPARE:
 		expr->compare.name = name;
-- 
2.35.1


             reply	other threads:[~2022-06-01 10:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-01 10:26 Steven Rostedt [this message]
2022-06-01 12:38 ` [PATCH] libtracefs: Have labels in selections be synthetic fields Harald Seiler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220601062619.2f601c8a@rorschach.local.home \
    --to=rostedt@goodmis.org \
    --cc=hws@denx.de \
    --cc=linux-trace-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).