*are released as well.
****************************************************************************/
-LttTrace *ltt_trace_open(char *pathname)
+LttTrace *ltt_trace_open(const char *pathname)
{
LttTrace * t;
LttSystemDescription * sys_description;
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;
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;
}
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{
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;
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;