X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Fltt%2Ftracefile.c;h=d78125873222f972399eb6efafa385265da726be;hb=80da81adfa88158bd3d4c26f89f96f8b58c77b4f;hp=05978a489b306d15f632a086674c6919506ab7ac;hpb=01a5c7e14a0f0fe5ad4a1256376252bcb53808a7;p=lttv.git diff --git a/ltt/branches/poly/ltt/tracefile.c b/ltt/branches/poly/ltt/tracefile.c index 05978a48..d7812587 100644 --- a/ltt/branches/poly/ltt/tracefile.c +++ b/ltt/branches/poly/ltt/tracefile.c @@ -670,6 +670,15 @@ char *ltt_tracefile_name(LttTracefile *tf) 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 @@ -742,6 +751,32 @@ void ltt_tracefile_seek_time(LttTracefile *t, LttTime 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