Re: [PATCH 01/17] libtracefs: Added new API tracefs_sql()

From: Namhyung Kim
Date: Mon Aug 02 2021 - 19:45:56 EST


Hi Steve,

On Fri, Jul 30, 2021 at 3:18 PM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx>
>
> This adds the API tracefs_sql() that takes a tep_handle handler, a name,
> and a SQL string and parses it to produce a tracefs_synth synthetic event
> handler.
>
> Currently it only supports simple SQL of the type:
>
> SELECT start.common_pid AS pid, end.common_timestamp.usecs AS usecs
> FROM sched_waking AS start on sched_switch AS end
> ON start.pid = end.next_pid
>
> Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
> ---

[SNIP]
> diff --git a/src/sqlhist.l b/src/sqlhist.l
> new file mode 100644
> index 000000000000..3f394f37b738
> --- /dev/null
> +++ b/src/sqlhist.l
> @@ -0,0 +1,88 @@
> +%{
> +/* code here */
> +
> +#include <stdarg.h>
> +#include "sqlhist-parse.h"
> +
> +extern int my_yyinput(char *buf, int max);
> +
> +#undef YY_INPUT
> +#define YY_INPUT(b, r, m) ({r = my_yyinput(b, m);})
> +
> +#define YY_NO_INPUT
> +#define YY_NO_UNPUT
> +
> +#define YY_EXTRA_TYPE struct sqlhist_bison *
> +
> +#define HANDLE_COLUMN do { sb->line_idx += strlen(yytext); } while (0)
> +
> +%}
> +
> +%option caseless
> +
> +field [a-z_][a-z0-9_\.]*
> +qstring \"[^\"]*\"
> +hexnum 0x[0-9a-z]+
> +number [0-9a-z]+

Do you mean a-f ?

Thanks,
Namhyung