}
+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.
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_warning("test %s test", g_quark_to_string(ltt_tracefile_name(tracefile)));
+ 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);
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 cpu %u position %u/%u",
+ g_quark_to_string(ltt_trace_name(ltt_tracefile_get_trace(tracefile))),
+ g_quark_to_string(ltt_tracefile_name(tracefile)),
+ ltt_tracefile_num(tracefile), nb_block, offset);
+ g_warning("last time %lu.%lu vs current %lu.%lu",
+ previous_time.tv_sec, previous_time.tv_nsec,
+ time.tv_sec, time.tv_nsec);
}
#if 0 //FIXME
close:
fclose(fp);
- ltt_event_destroy(event);
}
static gboolean process_traceset(void __UNUSED__ *hook_data,
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));
g_datalist_foreach(tracefiles_groups,
(GDataForeachFunc)compute_tracefile_group,
- compute_tracefile);
+ &args);
}
}