return (LttTracefile*)g_ptr_array_index(t->per_cpu_tracefiles, i);
}
+/*****************************************************************************
+ * Get the start time and end time of the trace
+ ****************************************************************************/
+
+void ltt_trace_time_span_get(LttTrace *t, LttTime *start, LttTime *end)
+{
+ LttTime startSmall, startTmp, endBig, endTmp;
+ int i, j=0;
+ LttTracefile * tf;
+
+ for(i=0;i<t->control_tracefile_number;i++){
+ tf = g_ptr_array_index(t->control_tracefiles, i);
+ readBlock(tf,1);
+ startTmp = tf->a_block_start->time;
+ readBlock(tf,tf->block_number);
+ endTmp = tf->a_block_end->time;
+ if(i==0){
+ startSmall = startTmp;
+ endBig = endTmp;
+ j = 1;
+ continue;
+ }
+ if(timecmp(&startSmall,&startTmp) > 0) startSmall = startTmp;
+ if(timecmp(&endBig,&endTmp) < 0) endBig = endTmp;
+ }
+
+ for(i=0;i<t->per_cpu_tracefile_number;i++){
+ tf = g_ptr_array_index(t->per_cpu_tracefiles, i);
+ readBlock(tf,1);
+ startTmp = tf->a_block_start->time;
+ readBlock(tf,tf->block_number);
+ endTmp = tf->a_block_end->time;
+ if(j == 0 && i==0){
+ startSmall = startTmp;
+ endBig = endTmp;
+ continue;
+ }
+ if(timecmp(&startSmall,&startTmp) > 0) startSmall = startTmp;
+ if(timecmp(&endBig,&endTmp) < 0) endBig = endTmp;
+ }
+
+ *start = startSmall;
+ *end = endBig;
+}
+
+
/*****************************************************************************
*Get the name of a tracefile
****************************************************************************/
return tf->name;
}
+/*****************************************************************************
+ * Get the number of blocks in the tracefile
+ ****************************************************************************/
+
+unsigned ltt_tracefile_block_number(LttTracefile *tf)
+{
+ return tf->block_number;
+}
+
/*****************************************************************************
*Function name
* ltt_tracefile_seek_time: seek to the first event of the trace with time
}
}
+/*****************************************************************************
+ * Seek to the first event with position equal or larger to ep
+ ****************************************************************************/
+
+void ltt_tracefile_seek_position(LttTracefile *t, LttEventPosition *ep)
+{
+ //if we are at the right place, just return
+ if(t->which_block == ep->block_num && t->which_event == ep->event_num)
+ return;
+
+ if(t->which_block == ep->block_num) updateTracefile(t);
+ else readBlock(t,ep->block_num);
+
+ //event offset is availiable
+ if(ep->old_position){
+ t->cur_heart_beat_number = ep->heart_beat_number;
+ t->cur_event_pos = t->buffer + ep->event_offset;
+ return;
+ }
+
+ //only block number and event index are availiable
+ while(t->which_event < ep->event_num) ltt_tracefile_read(t);
+
+ return;
+}
+
/*****************************************************************************
*Function name
* ltt_tracefile_read : read the current event, set the pointer to the next
if(t->cur_event_pos == t->buffer + t->block_size){
if(t->which_block == t->block_number){
- g_free(lttEvent);
return NULL;
}
err = readBlock(t, t->which_block + 1);