X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttv%2Fmodules%2Ftext%2FbatchAnalysis.c;h=7d55f44db93afca8cfa71ef6703160774b798a30;hb=c7cb53d7585f0e82f031f0f330f71f773c1d95c8;hp=f78f37749f28e27f7d4f22ae5bfe6eea600f5c71;hpb=f61f4dca50e13aa52b1ca3941c8f420848f4353f;p=lttv.git diff --git a/lttv/modules/text/batchAnalysis.c b/lttv/modules/text/batchAnalysis.c index f78f3774..7d55f44d 100644 --- a/lttv/modules/text/batchAnalysis.c +++ b/lttv/modules/text/batchAnalysis.c @@ -34,6 +34,7 @@ #include #include #include +#include static LttvTraceset *traceset; @@ -67,13 +68,14 @@ static gboolean process_traceset(void *hook_data, void *call_data) LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes()); - LttvTracesetStats *tscs; + LttvTracesetStats *tscs = NULL; LttvTracesetState *tss; LttvTracesetContext *tc; LttTime start, end; + gboolean retval; g_info("BatchAnalysis begin process traceset"); @@ -88,14 +90,26 @@ static gboolean process_traceset(void *hook_data, void *call_data) g_info("BatchAnalysis initialize context"); lttv_context_init(tc, traceset); - lttv_state_add_event_hooks(tc); + + syncTraceset(tc); + + lttv_state_add_event_hooks(tss); if(a_stats) lttv_stats_add_event_hooks(tscs); - g_assert(lttv_iattribute_find_by_path(attributes, "filter/expression", - LTTV_POINTER, &value_expression)); + retval= lttv_iattribute_find_by_path(attributes, "filter/expression", + LTTV_POINTER, &value_expression); + g_assert(retval); + + retval= lttv_iattribute_find_by_path(attributes, "filter/lttv_filter", + LTTV_POINTER, &value_filter); + g_assert(retval); - g_assert(lttv_iattribute_find_by_path(attributes, "filter/lttv_filter", - LTTV_POINTER, &value_filter)); + /* Repeat the search for the first element, the second search might have + * moved the first element (by creating the second element) + */ + retval= lttv_iattribute_find_by_path(attributes, "filter/expression", + LTTV_POINTER, &value_expression); + g_assert(retval); *(value_filter.v_pointer) = lttv_filter_new(); //g_debug("Filter string: %s",((GString*)*(value_expression.v_pointer))->str); @@ -157,6 +171,7 @@ static void init() LttvAttributeValue value; LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes()); + gboolean retval; g_info("Init batchAnalysis.c"); @@ -184,23 +199,29 @@ static void init() //after_event = lttv_hooks_new(); event_hook = lttv_hooks_new(); - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/traceset/before", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/traceset/before", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = before_traceset; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/traceset/after", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/traceset/after", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = after_traceset; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/trace/before", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/trace/before", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = before_trace; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/trace/after", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/trace/after", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = after_trace; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/tracefile/before", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/tracefile/before", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = before_tracefile; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/tracefile/after", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/tracefile/after", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = after_tracefile; //g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event/before", // LTTV_POINTER, &value)); @@ -208,12 +229,14 @@ static void init() //g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event/after", // LTTV_POINTER, &value)); //*(value.v_pointer) = after_event; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/event", + LTTV_POINTER, &value); + g_assert(retval); *(value.v_pointer) = event_hook; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/main/before", - LTTV_POINTER, &value)); + retval= lttv_iattribute_find_by_path(attributes, "hooks/main/before", + LTTV_POINTER, &value); + g_assert(retval); g_assert((main_hooks = *(value.v_pointer)) != NULL); lttv_hooks_add(main_hooks, process_traceset, NULL, LTTV_PRIO_DEFAULT); } @@ -253,4 +276,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","textFilter") + init, destroy, "state", "stats", "option","textFilter", "sync")