projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: add mmap_base_offset to ctf_stream_pos
[babeltrace.git]
/
lib
/
iterator.c
diff --git
a/lib/iterator.c
b/lib/iterator.c
index c6ee4c9c0dba3ebf53883a8ad4a7c7c53c1a2ada..0d101048720fed7944524ef080b542ed26c6a783 100644
(file)
--- a/
lib/iterator.c
+++ b/
lib/iterator.c
@@
-41,7
+41,8
@@
struct stream_saved_pos {
struct ctf_file_stream *file_stream;
size_t cur_index; /* current index in packet index */
ssize_t offset; /* offset from base, in bits. EOF for end of file. */
struct ctf_file_stream *file_stream;
size_t cur_index; /* current index in packet index */
ssize_t offset; /* offset from base, in bits. EOF for end of file. */
- uint64_t current_timestamp;
+ uint64_t current_real_timestamp;
+ uint64_t current_cycles_timestamp;
};
struct bt_saved_pos {
};
struct bt_saved_pos {
@@
-66,11
+67,11
@@
static int stream_read_event(struct ctf_file_stream *sin)
/*
* returns true if a < b, false otherwise.
*/
/*
* returns true if a < b, false otherwise.
*/
-int stream_compare(void *a, void *b)
+
static
int stream_compare(void *a, void *b)
{
struct ctf_file_stream *s_a = a, *s_b = b;
{
struct ctf_file_stream *s_a = a, *s_b = b;
- if (s_a->parent.
timestamp < s_b->parent.
timestamp)
+ if (s_a->parent.
real_timestamp < s_b->parent.real_
timestamp)
return 1;
else
return 0;
return 1;
else
return 0;
@@
-111,8
+112,8
@@
static int seek_file_stream_by_timestamp(struct ctf_file_stream *cfs,
int i, ret;
stream_pos = &cfs->pos;
int i, ret;
stream_pos = &cfs->pos;
- for (i = 0; i < stream_pos->packet_index->len; i++) {
- index = &g_array_index(stream_pos->packet_index,
+ for (i = 0; i < stream_pos->packet_
real_
index->len; i++) {
+ index = &g_array_index(stream_pos->packet_
real_
index,
struct packet_index, i);
if (index->timestamp_end < timestamp)
continue;
struct packet_index, i);
if (index->timestamp_end < timestamp)
continue;
@@
-120,7
+121,7
@@
static int seek_file_stream_by_timestamp(struct ctf_file_stream *cfs,
stream_pos->packet_seek(&stream_pos->parent, i, SEEK_SET);
do {
ret = stream_read_event(cfs);
stream_pos->packet_seek(&stream_pos->parent, i, SEEK_SET);
do {
ret = stream_read_event(cfs);
- } while (cfs->parent.timestamp < timestamp && ret == 0);
+ } while (cfs->parent.
real_
timestamp < timestamp && ret == 0);
/* Can return either EOF, 0, or error (> 0). */
return ret;
/* Can return either EOF, 0, or error (> 0). */
return ret;
@@
-221,17
+222,20
@@
int bt_iter_set_pos(struct bt_iter *iter, const struct bt_iter_pos *iter_pos)
* packet_seek, because this function resets
* the timestamp to the beginning of the packet
*/
* packet_seek, because this function resets
* the timestamp to the beginning of the packet
*/
- stream->timestamp = saved_pos->current_timestamp;
+ stream->real_timestamp = saved_pos->current_real_timestamp;
+ stream->cycles_timestamp = saved_pos->current_cycles_timestamp;
stream_pos->offset = saved_pos->offset;
stream_pos->last_offset = LAST_OFFSET_POISON;
stream_pos->offset = saved_pos->offset;
stream_pos->last_offset = LAST_OFFSET_POISON;
- stream->prev_timestamp = 0;
- stream->prev_timestamp_end = 0;
+ stream->prev_real_timestamp = 0;
+ stream->prev_real_timestamp_end = 0;
+ stream->prev_cycles_timestamp = 0;
+ stream->prev_cycles_timestamp_end = 0;
printf_debug("restored to cur_index = %zd and "
"offset = %zd, timestamp = %" PRIu64 "\n",
stream_pos->cur_index,
printf_debug("restored to cur_index = %zd and "
"offset = %zd, timestamp = %" PRIu64 "\n",
stream_pos->cur_index,
- stream_pos->offset, stream->timestamp);
+ stream_pos->offset, stream->
real_
timestamp);
stream_read_event(saved_pos->file_stream);
stream_read_event(saved_pos->file_stream);
@@
-373,7
+377,8
@@
struct bt_iter_pos *bt_iter_get_pos(struct bt_iter *iter)
saved_pos.file_stream = file_stream;
saved_pos.cur_index = file_stream->pos.cur_index;
saved_pos.file_stream = file_stream;
saved_pos.cur_index = file_stream->pos.cur_index;
- saved_pos.current_timestamp = file_stream->parent.timestamp;
+ saved_pos.current_real_timestamp = file_stream->parent.real_timestamp;
+ saved_pos.current_cycles_timestamp = file_stream->parent.cycles_timestamp;
g_array_append_val(
pos->u.restore->stream_saved_pos,
g_array_append_val(
pos->u.restore->stream_saved_pos,
@@
-384,7
+389,7
@@
struct bt_iter_pos *bt_iter_get_pos(struct bt_iter *iter)
"timestamp = %" PRIu64 "\n",
file_stream->parent.stream_id,
saved_pos.cur_index, saved_pos.offset,
"timestamp = %" PRIu64 "\n",
file_stream->parent.stream_id,
saved_pos.cur_index, saved_pos.offset,
- saved_pos.current_timestamp);
+ saved_pos.current_
real_
timestamp);
/* remove the stream from the heap copy */
removed = heap_remove(&iter_heap_copy);
/* remove the stream from the heap copy */
removed = heap_remove(&iter_heap_copy);
This page took
0.02435 seconds
and
4
git commands to generate.