linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libtracefs: Have labels in selections be synthetic fields
@ 2022-06-01 10:26 Steven Rostedt
  2022-06-01 12:38 ` Harald Seiler
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2022-06-01 10:26 UTC (permalink / raw)
  To: Linux Trace Devel; +Cc: hws

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] libtracefs: Have labels in selections be synthetic fields
  2022-06-01 10:26 [PATCH] libtracefs: Have labels in selections be synthetic fields Steven Rostedt
@ 2022-06-01 12:38 ` Harald Seiler
  0 siblings, 0 replies; 2+ messages in thread
From: Harald Seiler @ 2022-06-01 12:38 UTC (permalink / raw)
  To: Steven Rostedt, Linux Trace Devel

On Wed, 2022-06-01 at 06:26 -0400, Steven Rostedt wrote:
> 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>

Tested-by: Harald Seiler <hws@denx.de>

> ---
>  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;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-01 12:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-01 10:26 [PATCH] libtracefs: Have labels in selections be synthetic fields Steven Rostedt
2022-06-01 12:38 ` Harald Seiler

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).