fix type casting
[lttv.git] / ltt / branches / poly / lttv / lttv / batchtest.c
index 181734db0f0ebcbbbdc0a88ebfb6d336474f4fc0..1db159c5280e280844303ea8e10ee9f44b894966 100644 (file)
@@ -99,8 +99,11 @@ static void lttv_trace_option(void __UNUSED__ *hook_data)
   LttTrace *trace;
 
   trace = ltt_trace_open(a_trace);
-  if(trace == NULL) g_critical("cannot open trace %s", a_trace);
-  lttv_traceset_add(traceset, lttv_trace_new(trace));
+  if(trace == NULL) {
+    g_critical("cannot open trace %s", a_trace);
+  } else {
+    lttv_traceset_add(traceset, lttv_trace_new(trace));
+  }
 }
 
 static double get_time() 
@@ -248,11 +251,20 @@ 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, 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;
@@ -260,6 +272,7 @@ static void compute_tracefile(LttTracefile *tracefile, void *hook_data)
   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 +281,13 @@ static void compute_tracefile(LttTracefile *tracefile, void *hook_data)
 
 
   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);
@@ -295,8 +314,13 @@ static void compute_tracefile(LttTracefile *tracefile, void *hook_data)
         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
This page took 0.026195 seconds and 4 git commands to generate.