From: siboud Date: Fri, 4 Feb 2005 02:49:02 +0000 (+0000) Subject: starting to work on lttv filter X-Git-Tag: v0.12.20~2625 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=31452f49b69a3cac00a22a307ebd3b587685c5fa;p=lttv.git starting to work on lttv filter modified filter.c and filter.h modified Makefile.am lttv/lttv/Makefile.am lttv/modules/text/Makefile.am git-svn-id: http://ltt.polymtl.ca/svn@864 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/Makefile.am b/ltt/branches/poly/Makefile.am index 9b5e422f..1fc073f1 100644 --- a/ltt/branches/poly/Makefile.am +++ b/ltt/branches/poly/Makefile.am @@ -1,6 +1,6 @@ # WARNING : ltt must come before lttv, so that the traceread library is # up to date -SUBDIRS = ltt lttv lttd doc +SUBDIRS = ltt lttv lttd diff --git a/ltt/branches/poly/lttv/lttv/Makefile.am b/ltt/branches/poly/lttv/lttv/Makefile.am index 3ccb55c3..f5418040 100644 --- a/ltt/branches/poly/lttv/lttv/Makefile.am +++ b/ltt/branches/poly/lttv/lttv/Makefile.am @@ -20,15 +20,16 @@ lttvinclude_HEADERS = \ state.h\ stats.h\ tracecontext.h\ - traceset.h - -noinst_HEADERS = \ + traceset.h\ filter.h +#noinst_HEADERS = \ +# filter.h + lttv_SOURCES = batchtest.c main.c module.c option.c \ hook.c attribute.c \ iattribute.c state.c stats.c \ - tracecontext.c traceset.c + tracecontext.c traceset.c filter.c if LTTVSTATIC lttv_LDFLAGS = -profile -static diff --git a/ltt/branches/poly/lttv/lttv/filter.c b/ltt/branches/poly/lttv/lttv/filter.c index 74cd30e1..a5185ae4 100644 --- a/ltt/branches/poly/lttv/lttv/filter.c +++ b/ltt/branches/poly/lttv/lttv/filter.c @@ -16,12 +16,14 @@ * MA 02111-1307, USA. */ - +/* consist in AND, OR and NOT nested expressions, forming a tree with simple relations as leaves. The simple relations test is a field in an event is equal, not equal, smaller, smaller or equal, larger, or larger or equal to a specified value. */ +#include + typedef enum _lttv_expression_op { LTTV_FIELD_EQ, LTTV_FIELD_NE, @@ -31,46 +33,80 @@ typedef enum _lttv_expression_op LTTV_FIELD_GE } lttv_expression_op; -typedef _lttv_simple_expression -{ lttv_expression_op op; +typedef enum _lttv_expression_type +{ + LTTV_EXPRESSION, + LTTV_SIMPLE_EXPRESSION +} lttv_expression_type; + +typedef struct _lttv_simple_expression +{ + lttv_expression_op op; char *field_name; char *value; } lttv_simple_expression; -typedef _lttv_expression_type -{ LTTV_EXPRESSION, - LTTV_SIMPLE_EXPRESSION - -} typedef struct _lttv_expression -{ bool or; - bool not; - bool simple_expression; - union - { lttv_expression *e; - lttv_field_relation *se; - } e; +{ + gboolean or; + gboolean not; + gboolean simple_expression; +// union e +// { +// lttv_expression *e; +// lttv_field_relation *se; +// }; } lttv_expression; -read_token +/* + read_token -read_expression - ( read expr ) - simple expr [ op expr ] + read_expression + ( read expr ) + simple expr [ op expr ] -read_simple_expression - read_field_path [ rel value ] + read_simple_expression + read_field_path [ rel value ] -read_field_path - read_field_component [. field path] + read_field_path + read_field_component [. field path] -read_field_component - name [ \[ value \] ] + read_field_component + name [ \[ value \] ] -data struct: -and/or(left/right) -not(child) -op(left/right) -path(component...) -> field + data struct: + and/or(left/right) + not(child) + op(left/right) + path(component...) -> field +*/ + +/** + * create a new lttv_filter + * @param expression filtering options string + * @param t pointer to the current LttvTrace + * @return the current lttv_filter + */ +lttv_filter* +lttv_filter_new(char *expression, LttvTrace *t) { + g_print("filter::lttv_filter_new()\n"); /* debug */ + /* + * 1. parse expression + * 2. construct binary tree + * 3. return corresponding filter + */ + + +} + +gboolean +lttv_filter_tracefile(lttv_filter *filter, void *tracefile) { + +} + +gboolean +lttv_filter_event(lttv_filter *filter, void *event) { + +} diff --git a/ltt/branches/poly/lttv/lttv/filter.h b/ltt/branches/poly/lttv/lttv/filter.h index 560c45d1..c6a53e58 100644 --- a/ltt/branches/poly/lttv/lttv/filter.h +++ b/ltt/branches/poly/lttv/lttv/filter.h @@ -19,6 +19,8 @@ #ifndef FILTER_H #define FILTER_H +#include + /* A filter expression consists in nested AND, OR and NOT expressions involving boolean relation (>, >=, =, !=, <, <=) between event fields and specific values. It is compiled into an efficient data structure which @@ -43,21 +45,23 @@ */ - +/** + * @struct lttv_filter + * ( will later contain a binary tree of filtering options ) + */ typedef struct _lttv_filter lttv_filter; - /* Compile the filter expression into an efficient data structure */ -lttv_filter *lttv_filter_new(char *expression, lttv_trace *t); +lttv_filter *lttv_filter_new(char *expression, LttvTrace *t); /* Check if the tracefile or event satisfies the filter. The arguments are declared as void * to allow these functions to be used as hooks. */ -bool lttv_filter_tracefile(void *filter, void *tracefile); +gboolean lttv_filter_tracefile(lttv_filter *filter, void *tracefile); -bool lttv_filter_event(void *filter, void *event); +gboolean lttv_filter_event(lttv_filter *filter, void *event); #endif // FILTER_H diff --git a/ltt/branches/poly/lttv/modules/text/Makefile.am b/ltt/branches/poly/lttv/modules/text/Makefile.am index 88f9235f..947ddd9b 100644 --- a/ltt/branches/poly/lttv/modules/text/Makefile.am +++ b/ltt/branches/poly/lttv/modules/text/Makefile.am @@ -5,11 +5,13 @@ LIBS += $(GLIB_LIBS) -lgobject-2.0 -L$(top_srcdir)/ltt -ltraceread libdir = ${lttvplugindir} -lib_LTLIBRARIES = libtextDump.la libbatchAnalysis.la +lib_LTLIBRARIES = libtextDump.la libbatchAnalysis.la libtextFilter.la libtextDump_la_LDFLAGS = -module libtextDump_la_SOURCES = textDump.c libbatchAnalysis_la_LDFLAGS = -module libbatchAnalysis_la_SOURCES = batchAnalysis.c +libtextFilter_la_LDFLAGS = -module +libtextFilter_la_SOURCES = textFilter.c noinst_HEADERS = \ batchanalysis.h