Fix: seek by timestamp
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 9 Mar 2012 23:26:09 +0000 (18:26 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 9 Mar 2012 23:26:09 +0000 (18:26 -0500)
When seeking a stream by timestamp, we need to match the first packet in
the stream that is at (or after) the timestamp to seek to. Failure to do
so is a bug: if we have many streams, and seek all streams to a
timestamp that is after the start time of some of the streams, those
late comers will show no events.

Reported-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lib/iterator.c

index 686ddb1bfdcb9e80d46dfe89736c2fdaa4a01cd6..0af151402b429d3fe95d9c92c42e9e07eb9436f5 100644 (file)
@@ -110,8 +110,7 @@ static int seek_file_stream_by_timestamp(struct ctf_file_stream *cfs,
        for (i = 0; i < stream_pos->packet_index->len; i++) {
                index = &g_array_index(stream_pos->packet_index,
                                struct packet_index, i);
        for (i = 0; i < stream_pos->packet_index->len; i++) {
                index = &g_array_index(stream_pos->packet_index,
                                struct packet_index, i);
-               if (index->timestamp_begin >= timestamp ||
-                               index->timestamp_end <= timestamp)
+               if (index->timestamp_end <= timestamp)
                        continue;
 
                stream_pos->packet_seek(&stream_pos->parent, i, SEEK_SET);
                        continue;
 
                stream_pos->packet_seek(&stream_pos->parent, i, SEEK_SET);
This page took 0.024733 seconds and 4 git commands to generate.