From 9d22769951d59db05e925e55b5f454534af0b2b9 Mon Sep 17 00:00:00 2001 From: compudj Date: Thu, 1 Sep 2005 23:53:08 +0000 Subject: [PATCH] seek backward beginning of trace fix git-svn-id: http://ltt.polymtl.ca/svn@1112 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/lttv/lttv/tracecontext.c | 13 +++++-------- ltt/branches/poly/lttv/lttv/tracecontext.h | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/ltt/branches/poly/lttv/lttv/tracecontext.c b/ltt/branches/poly/lttv/lttv/tracecontext.c index 98ffffa7..73096b3d 100644 --- a/ltt/branches/poly/lttv/lttv/tracecontext.c +++ b/ltt/branches/poly/lttv/lttv/tracecontext.c @@ -1409,8 +1409,8 @@ guint lttv_process_traceset_seek_n_backward(LttvTracesetContext *self, LttvTracesetContextPosition *saved_pos = lttv_traceset_context_position_new(self); LttTime time; + LttTime asked_time; LttTime time_offset; - LttTime last_time = ltt_time_infinite; struct seek_back_data sd; LttvHooks *hooks = lttv_hooks_new(); @@ -1432,6 +1432,7 @@ guint lttv_process_traceset_seek_n_backward(LttvTracesetContext *self, if(ltt_time_compare(time, self->time_span.end_time) > 0) { time = self->time_span.end_time; } + asked_time = time; time_offset = first_offset; lttv_hooks_add(hooks, seek_back_event_hook, &sd, LTTV_PRIO_DEFAULT); @@ -1440,14 +1441,15 @@ guint lttv_process_traceset_seek_n_backward(LttvTracesetContext *self, while(1) { /* stop criteria : - n events found - * - time < beginning of trace */ - if(ltt_time_compare(time, self->time_span.start_time) < 0) break; + * - asked_time < beginning of trace */ + if(ltt_time_compare(asked_time, self->time_span.start_time) < 0) break; lttv_traceset_context_position_copy(end_pos, next_iter_end_pos); /* We must seek the traceset back to time - time_offset */ /* this time becomes the new reference time */ time = ltt_time_sub(time, time_offset); + asked_time = time; time_seeker(self, time); lttv_traceset_context_position_save(self, next_iter_end_pos); @@ -1456,11 +1458,6 @@ guint lttv_process_traceset_seek_n_backward(LttvTracesetContext *self, if(ltt_time_compare(time, self->time_span.end_time) > 0) { time = self->time_span.end_time; } - /* if we have the same time twice, it means we are at the beginning of the - * trace, and we seek back at the same position */ - if(ltt_time_compare(last_time, time) == 0 - && ltt_time_compare(time, self->time_span.start_time) == 0) break; - last_time = time; /* Process the traceset, calling a hook which adds events * to the array, overwriting the tail. It changes first_event and diff --git a/ltt/branches/poly/lttv/lttv/tracecontext.h b/ltt/branches/poly/lttv/lttv/tracecontext.h index df78677c..37c4ba17 100644 --- a/ltt/branches/poly/lttv/lttv/tracecontext.h +++ b/ltt/branches/poly/lttv/lttv/tracecontext.h @@ -348,7 +348,7 @@ void lttv_process_traceset_get_sync_data(LttvTracesetContext *tsc); #define BACKWARD_SEEK_MUL 2 /* Multiplication factor of time_offset between backward seek iterations */ -static const LttTime seek_back_default_offset = { 0, 1000000 }; +static const LttTime seek_back_default_offset = { 1, 0 }; guint lttv_process_traceset_seek_n_forward(LttvTracesetContext *self, guint n, -- 2.34.1