X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmodules%2Ftext%2FbatchAnalysis.c;h=1d1ac2348f2234c9d8a49ca7b27c4542ec18fd83;hb=12c59c3d7642704991efec208aff605b77fa32e5;hp=f26ed39a075db44fdf1e5cd61312afbf756e4882;hpb=9c3123113f395e7ea634c522e340604331359e7e;p=lttv.git diff --git a/ltt/branches/poly/lttv/modules/text/batchAnalysis.c b/ltt/branches/poly/lttv/modules/text/batchAnalysis.c index f26ed39a..1d1ac234 100644 --- a/ltt/branches/poly/lttv/modules/text/batchAnalysis.c +++ b/ltt/branches/poly/lttv/modules/text/batchAnalysis.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -39,8 +39,7 @@ static LttvHooks *after_trace, *before_tracefile, *after_tracefile, - *before_event, - *after_event, + *event_hook, *main_hooks; static char *a_trace; @@ -76,9 +75,15 @@ 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); - lttv_traceset_context_add_hooks(tc, - before_traceset, after_traceset, NULL, before_trace, after_trace, - NULL, before_tracefile, after_tracefile, NULL, before_event, after_event); + //lttv_traceset_context_add_hooks(tc, + //before_traceset, after_traceset, NULL, before_trace, after_trace, + //NULL, before_tracefile, after_tracefile, NULL, before_event, after_event); + lttv_process_traceset_begin(tc, + before_traceset, + before_trace, + before_tracefile, + event_hook, + NULL); start.tv_sec = 0; start.tv_nsec = 0; @@ -88,13 +93,23 @@ static gboolean process_traceset(void *hook_data, void *call_data) g_info("BatchAnalysis process traceset"); lttv_process_traceset_seek_time(tc, start); - lttv_process_traceset(tc, end, G_MAXULONG); + lttv_process_traceset_middle(tc, + end, + G_MAXULONG, + NULL); g_info("BatchAnalysis destroy context"); - lttv_traceset_context_remove_hooks(tc, - before_traceset, after_traceset, NULL, before_trace, after_trace, - NULL, before_tracefile, after_tracefile, NULL, before_event, after_event); + //lttv_traceset_context_remove_hooks(tc, + //before_traceset, after_traceset, NULL, before_trace, after_trace, + //NULL, before_tracefile, after_tracefile, NULL, before_event, after_event); + lttv_process_traceset_end(tc, + after_traceset, + after_trace, + after_tracefile, + event_hook, + NULL); + lttv_state_remove_event_hooks(&tscs->parent); if(a_stats) lttv_stats_remove_event_hooks(tscs); lttv_context_fini(tc); @@ -104,7 +119,7 @@ static gboolean process_traceset(void *hook_data, void *call_data) } -G_MODULE_EXPORT void init(LttvModule *self, int argc, char **argv) +static void init() { LttvAttributeValue value; @@ -132,8 +147,9 @@ G_MODULE_EXPORT void init(LttvModule *self, int argc, char **argv) after_trace = lttv_hooks_new(); before_tracefile = lttv_hooks_new(); after_tracefile = lttv_hooks_new(); - before_event = lttv_hooks_new(); - after_event = lttv_hooks_new(); + //before_event = lttv_hooks_new(); + //after_event = lttv_hooks_new(); + event_hook = lttv_hooks_new(); g_assert(lttv_iattribute_find_by_path(attributes, "hooks/traceset/before", LTTV_POINTER, &value)); @@ -153,21 +169,24 @@ G_MODULE_EXPORT void init(LttvModule *self, int argc, char **argv) g_assert(lttv_iattribute_find_by_path(attributes, "hooks/tracefile/after", LTTV_POINTER, &value)); *(value.v_pointer) = after_tracefile; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event/before", - LTTV_POINTER, &value)); - *(value.v_pointer) = before_event; - g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event/after", + //g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event/before", + // LTTV_POINTER, &value)); + //*(value.v_pointer) = before_event; + //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)); - *(value.v_pointer) = after_event; + *(value.v_pointer) = event_hook; g_assert(lttv_iattribute_find_by_path(attributes, "hooks/main/before", LTTV_POINTER, &value)); g_assert((main_hooks = *(value.v_pointer)) != NULL); - lttv_hooks_add(main_hooks, process_traceset, NULL); + lttv_hooks_add(main_hooks, process_traceset, NULL, LTTV_PRIO_DEFAULT); } -G_MODULE_EXPORT void destroy() +static void destroy() { guint i, nb; @@ -184,8 +203,9 @@ G_MODULE_EXPORT void destroy() lttv_hooks_destroy(after_trace); lttv_hooks_destroy(before_tracefile); lttv_hooks_destroy(after_tracefile); - lttv_hooks_destroy(before_event); - lttv_hooks_destroy(after_event); + //lttv_hooks_destroy(before_event); + //lttv_hooks_destroy(after_event); + lttv_hooks_destroy(event_hook); lttv_hooks_remove_data(main_hooks, process_traceset, NULL); nb = lttv_traceset_number(traceset); @@ -198,3 +218,7 @@ G_MODULE_EXPORT void destroy() lttv_traceset_destroy(traceset); } + +LTTV_MODULE("batchAnalysis", "Batch processing of a trace", \ + "Run through a trace calling all the registered hooks", \ + init, destroy, "state", "stats", "option")