Thread (26 messages) 26 messages, 3 authors, 2021-08-04

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

From: Namhyung Kim <namhyung@kernel.org>
Date: 2021-08-02 23:45:56
Also in: lkml

Hi Steve,

On Fri, Jul 30, 2021 at 3:18 PM Steven Rostedt [off-list ref] wrote:
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

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@goodmis.org>
---
[SNIP]
quoted hunk ↗ jump to hunk
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help