batchtest can now output the textdump
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sat, 20 Aug 2005 23:20:09 +0000 (23:20 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sat, 20 Aug 2005 23:20:09 +0000 (23:20 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1033 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/ltt/ltt-private.h
ltt/branches/poly/ltt/trace.h
ltt/branches/poly/ltt/tracefile.c
ltt/branches/poly/lttv/lttv/batchtest.c

index 9ef7d4818eda87253789217a876d942f30fe783a..c71c8fbc2665ac3d3f9606e68b5a7f3b49cd830a 100644 (file)
@@ -308,6 +308,7 @@ typedef struct _LttBuffer {
 
 struct _LttTracefile{
   gboolean cpu_online;               //is the cpu online ?
+  GQuark long_name;                  //tracefile complete filename
   GQuark name;                       //tracefile name
   guint cpu_num;                     //cpu number of the tracefile
   LttTrace * trace;                  //trace containing the tracefile
index e9b0ec7cfb17be00df7331aca2b98753c5f7a51f..970e291833d5fd8d1a169c9bb770008d5838595c 100644 (file)
@@ -81,6 +81,11 @@ void ltt_trace_time_span_get(LttTrace *t, LttTime *start, LttTime *end);
 
 GQuark ltt_tracefile_name(LttTracefile *tf);
 
+/* get the cpu number of the tracefile */
+
+guint ltt_tracefile_num(LttTracefile *tf);
+
+LttTrace *ltt_tracefile_get_trace(LttTracefile *tf);
 
 /* Get the number of blocks in the tracefile */
 
index 1b7e5ff7dbd231285f87ee1d02f12e4b6f60e642..c1fbbf3c138b79c921501dd9df477ae1319c10b9 100644 (file)
@@ -209,7 +209,7 @@ gint ltt_tracefile_open(LttTrace *t, gchar * fileName, LttTracefile *tf)
   int page_size = getpagesize();
 
   //open the file
-  tf->name = g_quark_from_string(fileName);
+  tf->long_name = g_quark_from_string(fileName);
   tf->trace = t;
   tf->fd = open(fileName, O_RDONLY);
   if(tf->fd < 0){
@@ -274,6 +274,11 @@ end:
   return -1;
 }
 
+LttTrace *ltt_tracefile_get_trace(LttTracefile *tf)
+{
+  return tf->trace;
+}
+
 #if 0
 /*****************************************************************************
  *Open control and per cpu tracefiles
@@ -680,6 +685,7 @@ static int open_tracefiles(LttTrace *trace, char *root_path,
       
       tmp_tf.cpu_online = 1;
       tmp_tf.cpu_num = num;
+      tmp_tf.name = name;
 
       group = g_datalist_id_get_data(&trace->tracefiles, name);
       if(group == NULL) {
@@ -1195,6 +1201,12 @@ GQuark ltt_tracefile_name(LttTracefile *tf)
   return tf->name;
 }
 
+
+guint ltt_tracefile_num(LttTracefile *tf)
+{
+  return tf->cpu_num;
+}
+
 /*****************************************************************************
  * Get the number of blocks in the tracefile 
  ****************************************************************************/
index 181734db0f0ebcbbbdc0a88ebfb6d336474f4fc0..8bb3743836959902303bb1dd9dc1a52ea3d8b4d1 100644 (file)
@@ -248,11 +248,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 +269,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 +278,12 @@ 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_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 +310,9 @@ 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 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
This page took 0.029151 seconds and 4 git commands to generate.