Update trace format to 2.4
[lttv.git] / ltt / tracefile.c
index 9cd130558e67392cf96c9e024f2bee7928b4e6ab..cbb39d0e88cf1c38f9016833734f4f91f309e842 100644 (file)
@@ -148,9 +148,9 @@ static int parse_trace_header(ltt_subbuffer_header_t *header,
     break;
   case 2:
     switch(header->minor_version) {
-    case 3:
+    case 4:
       {
-        struct ltt_subbuffer_header_2_3 *vheader = header;
+        struct ltt_subbuffer_header_2_4 *vheader = header;
         tf->buffer_header_size = ltt_subbuffer_header_size();
         tf->tscbits = 27;
         tf->eventbits = 5;
@@ -764,11 +764,6 @@ LttTrace *ltt_trace_open(const gchar *pathname)
   get_absolute_pathname(pathname, abs_path);
   t->pathname = g_quark_from_string(abs_path);
 
-  t->start_tsc = 0;
-  t->freq_scale = 1;
-  t->start_freq = 1;
-  t->start_time_from_tsc = ltt_time_zero;
-
   g_datalist_init(&t->tracefiles);
 
   /* Test to see if it looks like a trace */
@@ -790,6 +785,7 @@ LttTrace *ltt_trace_open(const gchar *pathname)
   closedir(dir);
   
   /* Open all the tracefiles */
+  t->start_freq= 0;
   if(open_tracefiles(t, abs_path, "")) {
     g_warning("Error opening tracefile %s", abs_path);
     goto find_error;
@@ -889,6 +885,8 @@ void ltt_tracefile_time_span_get(LttTracefile *tf,
     *end = ltt_time_zero;
   } else
     *end = tf->buffer.end.timestamp;
+
+  g_assert(end->tv_sec <= G_MAXUINT);
 }
 
 struct tracefile_time_span_get_args {
@@ -1389,22 +1387,24 @@ static gint map_block(LttTracefile * tf, guint block_num)
 
   tf->buffer.begin.cycle_count = ltt_get_uint64(LTT_GET_BO(tf),
                                               &header->cycle_count_begin);
-  tf->buffer.begin.freq = tf->trace->start_freq;
-
-  tf->buffer.begin.timestamp = ltt_interpolate_time_from_tsc(tf, 
-                                          tf->buffer.begin.cycle_count);
   tf->buffer.end.cycle_count = ltt_get_uint64(LTT_GET_BO(tf),
                                               &header->cycle_count_end);
-  tf->buffer.end.freq = tf->trace->start_freq;
-  
   tf->buffer.lost_size = ltt_get_uint32(LTT_GET_BO(tf),
                                         &header->lost_size);
-  tf->buffer.end.timestamp = ltt_interpolate_time_from_tsc(tf,
-                                        tf->buffer.end.cycle_count);
   tf->buffer.tsc =  tf->buffer.begin.cycle_count;
   tf->event.tsc = tf->buffer.tsc;
   tf->buffer.freq = tf->buffer.begin.freq;
 
+  if (tf->trace->start_freq)
+  {
+    tf->buffer.begin.freq = tf->trace->start_freq;
+    tf->buffer.begin.timestamp = ltt_interpolate_time_from_tsc(tf,
+      tf->buffer.begin.cycle_count);
+    tf->buffer.end.freq = tf->trace->start_freq;
+    tf->buffer.end.timestamp = ltt_interpolate_time_from_tsc(tf,
+      tf->buffer.end.cycle_count);
+  }
+
   /* FIXME
    * eventually support variable buffer size : will need a partial pre-read of
    * the headers to create an index when we open the trace... eventually. */
This page took 0.023822 seconds and 4 git commands to generate.