mbox series

[0/6] libtracefs: Fixes for sqlhist

Message ID 20220606192953.334315-1-rostedt@goodmis.org (mailing list archive)
Headers show
Series libtracefs: Fixes for sqlhist | expand

Message

Steven Rostedt June 6, 2022, 7:29 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

At Kernel Recipes, I demonstrated sqlhist and how to use it. Along the way,
I discovered several bugs. This series addresses those bugs that were found.

Steven Rostedt (Google) (6):
  libtracefs: Fix make sqlhist when built again
  libtracefs: Add libtracefs.a to dependency of sqlhist
  libtracefs: Differentiate FROM and JOIN events if they are the same
    event
  libtracefs: Use unique names for sql field variables
  libtracefs: Differentiate WHERE clause when FROM and TO events are the
    same
  libtracefs sqlhist: Report errors executing the commands

 Documentation/libtracefs-sql.txt |  18 ++++--
 include/tracefs-local.h          |   4 ++
 samples/Makefile                 |   4 +-
 src/sqlhist-parse.h              |   3 +-
 src/tracefs-hist.c               | 105 ++++++++++++++++++++++++++++---
 src/tracefs-sqlhist.c            |  44 +++++++++----
 6 files changed, 150 insertions(+), 28 deletions(-)

Comments

Harald Seiler June 7, 2022, 10:01 a.m. UTC | #1
Hi,

On Mon, 2022-06-06 at 15:29 -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> 
> At Kernel Recipes, I demonstrated sqlhist and how to use it. Along the way,
> I discovered several bugs. This series addresses those bugs that were found.

For the whole series:

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

As a sanity check I accumulated offcpu time for a process:

	sqlhist -e -n 'offcpu' 'SELECT start.prev_comm AS comm, (end.TIMESTAMP_USECS - start.TIMESTAMP_USECS) as lat FROM sched_switch as start JOIN sched_switch as end ON start.prev_pid == end.next_pid WHERE start.prev_comm == "ping"'
	echo "hist:keys=comm:vals=lat:sort=lat" >/sys/kernel/tracing/events/synthetic/offcpu/trigger

And then verified the collected time is consistent by comparing with
getrusage(2) values for the process (as returned by time(1)).

And indeed,

	wall_time == ru_utime + ru_stime + lat

So it is measuring exactly what I want.

Thanks again for getting this working!

> Steven Rostedt (Google) (6):
>   libtracefs: Fix make sqlhist when built again
>   libtracefs: Add libtracefs.a to dependency of sqlhist
>   libtracefs: Differentiate FROM and JOIN events if they are the same
>     event
>   libtracefs: Use unique names for sql field variables
>   libtracefs: Differentiate WHERE clause when FROM and TO events are the
>     same
>   libtracefs sqlhist: Report errors executing the commands
> 
>  Documentation/libtracefs-sql.txt |  18 ++++--
>  include/tracefs-local.h          |   4 ++
>  samples/Makefile                 |   4 +-
>  src/sqlhist-parse.h              |   3 +-
>  src/tracefs-hist.c               | 105 ++++++++++++++++++++++++++++---
>  src/tracefs-sqlhist.c            |  44 +++++++++----
>  6 files changed, 150 insertions(+), 28 deletions(-)
>