X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Flttv%2Fbatchtest.c;h=8bb3743836959902303bb1dd9dc1a52ea3d8b4d1;hb=d3d34f492bdbd2326ff345d8d1f84998df19f459;hp=c48f9d771226d045b421281deafe94235f3a1693;hpb=eed2ef37f908daf7b3f884b5d8f91dad03f10526;p=lttv.git diff --git a/ltt/branches/poly/lttv/lttv/batchtest.c b/ltt/branches/poly/lttv/lttv/batchtest.c index c48f9d77..8bb37438 100644 --- a/ltt/branches/poly/lttv/lttv/batchtest.c +++ b/ltt/branches/poly/lttv/lttv/batchtest.c @@ -248,18 +248,28 @@ gboolean save_state_event(void *hook_data, void *call_data) } +static void sanitize_name(gchar *name) +{ + while(*name != '\0') { + if(*name == '/') *name = '_'; + name++; + } + +} + -static void compute_tracefile(LttTracefile *tracefile) +static void compute_tracefile(LttTracefile *tracefile, void *hook_data) { GString *filename; - guint i, j, nb_equal, nb_block, offset; + guint nb_equal, nb_block, offset; guint64 tsc; FILE *fp; LttTime time, previous_time; - LttEvent *event = ltt_event_new(); + LttEvent *event = ltt_tracefile_get_event(tracefile); LttFacility *facility; LttEventType *event_type; int err; + gchar mod_name[PATH_MAX]; /* start_count is always initialized in this function _if_ there is always * a block_start before a block_end. @@ -268,7 +278,12 @@ static void compute_tracefile(LttTracefile *tracefile) filename = g_string_new(""); - g_string_printf(filename, "%s.%u.%u.trace", a_dump_tracefiles, i, j); + strcpy(mod_name, g_quark_to_string(ltt_tracefile_name(tracefile))); + + sanitize_name(mod_name); + + g_string_printf(filename, "%s.%s.%u.trace", a_dump_tracefiles, + mod_name, ltt_tracefile_num(tracefile)); fp = fopen(filename->str, "w"); if(fp == NULL) g_error("Cannot open %s", filename->str); g_string_free(filename, TRUE); @@ -285,15 +300,19 @@ static void compute_tracefile(LttTracefile *tracefile) time = ltt_event_time(event); ltt_event_position(event, a_event_position); ltt_event_position_get(a_event_position, &tf_pos, &nb_block, &offset, &tsc); - fprintf(fp,"%s.%s: %llu %lu.%09lu position %u/%u\n", - ltt_facility_name(facility), ltt_eventtype_name(event_type), + //fprintf(fp,"%s.%s: %llu %lu.%09lu position %u/%u\n", + fprintf(fp, "%s.%s: %llu %lu.%09lu position %u/%u, tracefile %s\n", + g_quark_to_string(ltt_facility_name(facility)), + g_quark_to_string(ltt_eventtype_name(event_type)), tsc, (unsigned long)time.tv_sec, (unsigned long)time.tv_nsec, - nb_block, offset); + nb_block, offset, + g_quark_to_string(ltt_tracefile_name(tracefile))); if(ltt_time_compare(time, previous_time) < 0) { - g_warning("Time decreasing trace %d tracefile %d position %u/%u", - i, j, nb_block, offset); + g_warning("Time decreasing trace %s tracefile %s position %u/%u", + g_quark_to_string(ltt_trace_name(ltt_tracefile_get_trace(tracefile))), + g_quark_to_string(ltt_tracefile_name(tracefile)), nb_block, offset); } #if 0 //FIXME @@ -331,7 +350,6 @@ static void compute_tracefile(LttTracefile *tracefile) close: fclose(fp); - ltt_event_destroy(event); } static gboolean process_traceset(void __UNUSED__ *hook_data, @@ -366,16 +384,21 @@ static gboolean process_traceset(void __UNUSED__ *hook_data, a_event_position = ltt_event_position_new(); - GData *tracefiles_groups; + GData **tracefiles_groups; + struct compute_tracefile_group_args args; + + args.func = compute_tracefile; + args.func_args = NULL; + if(a_dump_tracefiles != NULL) { for(i = 0 ; i < lttv_traceset_number(traceset) ; i++) { trace = lttv_trace(lttv_traceset_get(traceset, i)); tracefiles_groups = ltt_trace_get_tracefiles_groups(trace); - g_datalist_foreach(&tracefiles_groups, + g_datalist_foreach(tracefiles_groups, (GDataForeachFunc)compute_tracefile_group, - compute_tracefile); + &args); } }