X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttv%2Fmodules%2Ftext%2FbatchAnalysis.c;h=0fbde4d2a9fd34df8188fef17c761647089ee586;hb=b9ce0bad7daf7c0a2333c91fdb1e35d602afe17f;hp=ae661d47ac2f8c7a74beffc171b3534ac8bc238a;hpb=2bc1bcfb0fdff52b3350804d2824cd023f463f96;p=lttv.git diff --git a/lttv/modules/text/batchAnalysis.c b/lttv/modules/text/batchAnalysis.c index ae661d47..0fbde4d2 100644 --- a/lttv/modules/text/batchAnalysis.c +++ b/lttv/modules/text/batchAnalysis.c @@ -12,8 +12,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. */ /* This module inserts a hook in the program main loop. This hook processes @@ -30,13 +30,15 @@ #include #include #include -#include +#include #include +#ifdef BABEL_CLEANUP #include #include -#include +#endif +#ifdef BABEL_CLEANUP_SYNC #include - +#endif #include static LttvTraceset *traceset; @@ -75,13 +77,14 @@ void lttv_trace_option(void *hook_data) lttv_traceset_add(traceset, lttv_trace_new(trace));*/ if(lttv_traceset_add_path(traceset, trace_path) < 0) { - printf("Cannot add trace %s", trace_path); + g_error("Cannot add trace %s", trace_path); } } static gboolean process_traceset(void *hook_data, void *call_data) { +#ifdef BABEL_CLEANUP LttvAttributeValue value_expression, value_filter; LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes()); @@ -92,11 +95,13 @@ static gboolean process_traceset(void *hook_data, void *call_data) LttvTracesetContext *tc; - LttTime start, end; gboolean retval; +#endif + LttTime start, end; - g_info("BatchAnalysis begin process traceset"); + g_info("BatchAnalysis begin process traceset"); +#ifdef BABEL_CLEANUP if (a_stats) { tscs = g_object_new(LTTV_TRACESET_STATS_TYPE, NULL); tss = &tscs->parent; @@ -109,12 +114,12 @@ static gboolean process_traceset(void *hook_data, void *call_data) lttv_context_init(tc, traceset); -#ifdef BABEL_CLEANUP + syncTraceset(tc); lttv_state_add_event_hooks(tss); if(a_stats) lttv_stats_add_event_hooks(tscs); -#endif + retval= lttv_iattribute_find_by_path(attributes, "filter/expression", LTTV_POINTER, &value_expression); @@ -135,16 +140,16 @@ static gboolean process_traceset(void *hook_data, void *call_data) //g_debug("Filter string: %s",((GString*)*(value_expression.v_pointer))->str); lttv_filter_append_expression(*(value_filter.v_pointer),((GString*)*(value_expression.v_pointer))->str); - +#endif //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, + + lttv_state_add_event_hooks(traceset); + lttv_process_traceset_begin(traceset, before_traceset, before_trace, - before_tracefile, - event_hook, - NULL); + event_hook); start.tv_sec = 0; start.tv_nsec = 0; @@ -153,12 +158,14 @@ 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_seek_time(traceset, start); /* Read as long a we do not reach the end (0) */ unsigned int count; +#ifdef BABEL_CLEANUP unsigned int updated_count; +#endif do { - count = lttv_process_traceset_middle(tc, + count = lttv_process_traceset_middle(traceset, end, G_MAXULONG, NULL); @@ -178,26 +185,24 @@ static gboolean process_traceset(void *hook_data, void *call_data) //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, + lttv_process_traceset_end(traceset, after_traceset, after_trace, - after_tracefile, - event_hook, - NULL); + event_hook); g_info("BatchAnalysis destroy context"); - - lttv_filter_destroy(*(value_filter.v_pointer)); #ifdef BABEL_CLEANUP + lttv_filter_destroy(*(value_filter.v_pointer)); + lttv_state_remove_event_hooks(tss); if(a_stats) lttv_stats_remove_event_hooks(tscs); -#endif + lttv_context_fini(tc); if (a_stats) g_object_unref(tscs); else g_object_unref(tss); - +#endif g_info("BatchAnalysis end process traceset"); return FALSE; } @@ -331,4 +336,5 @@ 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", "sync") + init, destroy, "state", "option") +//TODO ybrosseau 2012-05-15 reenable textFilter, stats, sync