mega modif by Mathieu Desnoyers. Independant main windows, multiple tracesets, contro...
[lttv.git] / ltt / branches / poly / ltt / tracefile.c
index 2ffa20be0e1f9dda3ad2daf005cdfb1939ec9065..a2f7bbadcc380376751ea64acaa6016ba8bd6afb 100644 (file)
@@ -404,7 +404,7 @@ void getCpuFileInfo(LttTrace *t, char* cpu)
  *are released as well.
  ****************************************************************************/
 
-LttTrace *ltt_trace_open(char *pathname)
+LttTrace *ltt_trace_open(const char *pathname)
 {
   LttTrace  * t;
   LttSystemDescription * sys_description;
@@ -463,6 +463,16 @@ LttTrace *ltt_trace_open(char *pathname)
   return t;
 }
 
+/******************************************************************************
+ * When we copy a trace, we want all the opening actions to happen again :
+ * the trace will be reopened and totally independant from the original.
+ * That's why we call ltt_trace_open.
+ *****************************************************************************/
+LttTrace *ltt_trace_copy(LttTrace *self)
+{
+  return ltt_trace_open(self->pathname);
+}
+
 void ltt_trace_close(LttTrace *t)
 {
   int i;
@@ -571,7 +581,7 @@ unsigned ltt_trace_eventtype_number(LttTrace *t)
   int i;
   unsigned count = 0;
   LttFacility * f;
-  for(i=0;i=t->facility_number;i++){
+  for(i=0;i<t->facility_number;i++){
     f = (LttFacility*)g_ptr_array_index(t->facilities, i);
     count += f->event_number;
   }
@@ -769,7 +779,7 @@ void ltt_tracefile_seek_time(LttTracefile *t, LttTime time)
       updateTracefile(t);
       return ltt_tracefile_seek_time(t, time);      
     }
-  }else if(headTime > 0){
+  }else if(headTime >= 0){
     if(t->which_block == 1){
       updateTracefile(t);      
     }else{
@@ -790,10 +800,8 @@ void ltt_tracefile_seek_time(LttTracefile *t, LttTime time)
       return;      
     }    
     if(tailTime < 0) return ltt_tracefile_seek_time(t, time);
-  }else if(headTime == 0){
-    updateTracefile(t);
   }else if(tailTime == 0){
-    t->cur_event_pos = t->a_block_end - EVENT_HEADER_SIZE;
+    t->cur_event_pos = t->last_event_pos;
     t->current_event_time = time;  
     t->cur_heart_beat_number = 0;
     t->prev_event_time.tv_sec = 0;
@@ -935,6 +943,7 @@ int readBlock(LttTracefile * tf, int whichBlock)
   lostSize = *(uint32_t*)(tf->buffer + tf->block_size - sizeof(uint32_t));
   tf->a_block_end=(BlockEnd *)(tf->buffer + tf->block_size - 
                                lostSize + EVENT_HEADER_SIZE); 
+  tf->last_event_pos = tf->buffer + tf->block_size - lostSize;
 
   tf->which_block = whichBlock;
   tf->which_event = 1;
This page took 0.028665 seconds and 4 git commands to generate.