* ltt_event_refresh_fields : refresh fields of an event
*Input params
* offsetRoot : offset from the root
- * offsetParent : offset from the parrent
+ * offsetParent : offset from the parent
* fld : field
* evD : event data
*Return value
ep->event_time = e->event_time;
ep->event_cycle_count = e->event_cycle_count;
ep->heart_beat_number = e->tracefile->cur_heart_beat_number;
- ep->old_position = FALSE;
+ ep->old_position = TRUE;
ep->event_offset = e->data - e->tracefile->buffer - EVENT_HEADER_SIZE ;
ep->tf = e->tracefile;
+
+ /* This is a workaround for fast position seek */
+ ep->last_event_pos = e->last_event_pos;
+ ep->prev_block_end_time = e->prev_block_end_time;
+ ep->prev_event_time = e->prev_event_time;
+ ep->pre_cycle_count = e->pre_cycle_count;
+ ep->count = e->count;
+ /* end of workaround */
}
LttEventPosition * ltt_event_position_new()
void * data; //event data
int which_block; //the current block of the event
int which_event; //the position of the event
+ /* This is a workaround for fast position seek */
+ void * last_event_pos;
+
+ LttTime prev_block_end_time; //the end time of previous block
+ LttTime prev_event_time; //the time of the previous event
+ LttCycleCount pre_cycle_count; //previous cycle count of the event
+ int count; //the number of overflow of cycle count
+ /* end of workaround */
};
struct _LttFacility{
LttTracefile *tf; //tracefile containing the event
gboolean old_position; //flag to show if it is the position
//being remembered
+ /* This is a workaround for fast position seek */
+ void * last_event_pos;
+
+ LttTime prev_block_end_time; //the end time of previous block
+ LttTime prev_event_time; //the time of the previous event
+ LttEvent an_event;
+ LttCycleCount pre_cycle_count; //previous cycle count of the event
+ int count; //the number of overflow of cycle count
+ /* end of workaround */
};
/* The characteristics of the system on which the trace was obtained
/*****************************************************************************
* Seek to the first event with position equal or larger to ep
+ *
+ * Modified by Mathieu Desnoyers to used faster offset position instead of
+ * re-reading the whole buffer.
****************************************************************************/
void ltt_tracefile_seek_position(LttTracefile *t, const LttEventPosition *ep)
if(t->which_block == ep->block_num) updateTracefile(t);
else readBlock(t,ep->block_num);
-
- //event offset is availiable
+ //event offset is available
if(ep->old_position){
- t->cur_heart_beat_number = ep->heart_beat_number;
+ int err;
+
+ t->which_event = ep->event_num;
t->cur_event_pos = t->buffer + ep->event_offset;
+ t->prev_event_time = ep->event_time;
+ t->current_event_time = ep->event_time;
+ t->cur_heart_beat_number = ep->heart_beat_number;
+ t->cur_cycle_count = ep->event_cycle_count;
+
+ /* This is a workaround for fast position seek */
+ t->last_event_pos = ep->last_event_pos;
+ t->prev_block_end_time = ep->prev_block_end_time;
+ t->prev_event_time = ep->prev_event_time;
+ t->pre_cycle_count = ep->pre_cycle_count;
+ t->count = ep->count;
+ /* end of workaround */
+
+ //update the fields of the current event and go to the next event
+ err = skipEvent(t);
+ if(err == ERANGE) g_error("event id is out of range\n");
+
return;
}
- //only block number and event index are availiable
+ //only block number and event index are available
+ //MD: warning : this is slow!
+ g_warning("using slow O(n) tracefile seek position");
+
while(t->which_event < ep->event_num) ltt_tracefile_read(t);
return;
lttEvent->which_block = t->which_block;
lttEvent->which_event = t->which_event;
+ /* This is a workaround for fast position seek */
+ lttEvent->last_event_pos = t->last_event_pos;
+ lttEvent->prev_block_end_time = t->prev_block_end_time;
+ lttEvent->prev_event_time = t->prev_event_time;
+ lttEvent->pre_cycle_count = t->pre_cycle_count;
+ lttEvent->count = t->count;
+ /* end of workaround */
+
+
+
//update the fields of the current event and go to the next event
err = skipEvent(t);
if(err == ERANGE) g_error("event id is out of range\n");
return 0;
}
+
/*****************************************************************************
*Function name
* getCyclePerNsec : calculate cycles per nsec for current block
return s->trace_start;
}
+
+LttTracefile *ltt_tracefile_new()
+{
+ return g_new(LttTracefile, 1);
+}
+
+void ltt_tracefile_destroy(LttTracefile *tf)
+{
+ g_free(tf);
+}
+
+void ltt_tracefile_copy(LttTracefile *dest, const LttTracefile *src)
+{
+ *dest = *src;
+}
+