From cec3d7b0a4303198eb608ecccd44454d56ab7b04 Mon Sep 17 00:00:00 2001 From: siboud Date: Sat, 26 Mar 2005 21:32:37 +0000 Subject: [PATCH] text module - added link to the batchAnalysis module - linked the textDump module to the actual filter core git-svn-id: http://ltt.polymtl.ca/svn@906 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/lttv/lttv/filter.c | 20 +++++++++---------- .../poly/lttv/modules/text/batchAnalysis.c | 5 +++-- .../poly/lttv/modules/text/textDump.c | 7 ++++++- .../poly/lttv/modules/text/textFilter.c | 12 ++++++----- 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/ltt/branches/poly/lttv/lttv/filter.c b/ltt/branches/poly/lttv/lttv/filter.c index b39b844c..b5986c9a 100644 --- a/ltt/branches/poly/lttv/lttv/filter.c +++ b/ltt/branches/poly/lttv/lttv/filter.c @@ -146,12 +146,12 @@ gboolean parse_field_path(GPtrArray* fp, LttvSimpleExpression* se) { GString* f = NULL; - g_print("fp->len:%i\n",fp->len); - int i; - for(i=0;ilen;i++) { - GString* f2 = g_ptr_array_index(fp,i); - g_print("%i=%s",i,f2->str); - } +// g_print("fp->len:%i\n",fp->len); +// int i; +// for(i=0;ilen;i++) { +// GString* f2 = g_ptr_array_index(fp,i); +// g_print("%i=%s",i,f2->str); +// } if(fp->len < 2) return FALSE; g_assert(f=g_ptr_array_index(fp,0)); //list_first(fp)->data; @@ -283,10 +283,10 @@ parse_field_path(GPtrArray* fp, LttvSimpleExpression* se) { */ gboolean assign_operator(LttvSimpleExpression* se, LttvExpressionOp op) { - g_print("se->field = %i\n",se->field); - g_print("se->offset = %i\n",se->offset); - g_print("se->op = %p\n",se->op); - g_print("se->value = %s\n",se->value); +// g_print("se->field = %i\n",se->field); +// g_print("se->offset = %i\n",se->offset); +// g_print("se->op = %p\n",se->op); +// g_print("se->value = %s\n",se->value); switch(se->field) { /* char */ diff --git a/ltt/branches/poly/lttv/modules/text/batchAnalysis.c b/ltt/branches/poly/lttv/modules/text/batchAnalysis.c index ec68e7f1..4482a35c 100644 --- a/ltt/branches/poly/lttv/modules/text/batchAnalysis.c +++ b/ltt/branches/poly/lttv/modules/text/batchAnalysis.c @@ -80,7 +80,8 @@ static gboolean process_traceset(void *hook_data, void *call_data) lttv_state_add_event_hooks(&tscs->parent); if(a_stats) lttv_stats_add_event_hooks(tscs); - a_lttv_filter = lttv_filter_new(a_filter_string,(LttvTraceState*)tscs); + a_lttv_filter = lttv_filter_new(); + lttv_filter_append_expression(a_lttv_filter,a_filter_string->str); //lttv_traceset_context_add_hooks(tc, //before_traceset, after_traceset, NULL, before_trace, after_trace, @@ -231,4 +232,4 @@ static void destroy() LTTV_MODULE("batchAnalysis", "Batch processing of a trace", \ "Run through a trace calling all the registered hooks", \ - init, destroy, "state", "stats", "option","filter") + init, destroy, "state", "stats", "option","textFilter") diff --git a/ltt/branches/poly/lttv/modules/text/textDump.c b/ltt/branches/poly/lttv/modules/text/textDump.c index ded3c897..fea42ef0 100644 --- a/ltt/branches/poly/lttv/modules/text/textDump.c +++ b/ltt/branches/poly/lttv/modules/text/textDump.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -49,7 +50,6 @@ static LttvHooks *before_trace, *event_hook; - void print_field(LttEvent *e, LttField *f, GString *s, gboolean field_names) { LttType *type; @@ -335,6 +335,11 @@ static int write_event_content(void *hook_data, void *call_data) e = tfc->e; + /* + * call to the filter if available + */ + // lttv_filter_tree_parse(f->head,e,NULL,NULL,NULL); + lttv_event_to_string(e, a_string, TRUE, a_field_names, tfs); g_string_append_printf(a_string,"\n"); diff --git a/ltt/branches/poly/lttv/modules/text/textFilter.c b/ltt/branches/poly/lttv/modules/text/textFilter.c index 83895e92..27b878a3 100644 --- a/ltt/branches/poly/lttv/modules/text/textFilter.c +++ b/ltt/branches/poly/lttv/modules/text/textFilter.c @@ -56,14 +56,12 @@ static char GString *a_filter_string = NULL; - static LttvHooks *before_traceset, *event_hook; static FILE *a_file; - /** * filters the file input from user * @param hook_data the hook data @@ -93,12 +91,14 @@ void filter_analyze_file(void *hook_data) { else { g_string_append(a_filter_string,"&"); /*conjonction between expression*/ } - + while(!feof(a_file)) { getline(&line,&len,a_file); g_string_append(a_filter_string,line); line = NULL; } + +// lttv_filter_append_expression(lttvfilter_t,a_filter_string->str); fclose(a_file); } @@ -122,10 +122,12 @@ void filter_analyze_string(void *hook_data) { g_string_append(a_filter_string,a_string); } else { - g_string_append(a_filter_string,"&"); /*conjonction between expression*/ + g_string_append(a_filter_string,"&"); g_string_append(a_filter_string,a_string); } +// lttv_filter_append_expression(lttvfilter_t,a_string); + } /** @@ -152,7 +154,7 @@ static void init() { LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes()); g_info("Init textFilter.c"); - + a_string = NULL; lttv_option_add("string", 's', "filters a string issued by the user on the command line", -- 2.34.1