X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Flttv%2Ftracecontext.c;h=1c2a7f4d4bb4ab950d655f7a00d80eb7febe7aa5;hb=a1a2b6492b9e18506e9429b71a90fcfff9da7f99;hp=395b3ab2c2e9334c1b6e49af730553de74c29696;hpb=a5ba178765a7f04e831a3e909f717ec7babfcf49;p=lttv.git diff --git a/ltt/branches/poly/lttv/lttv/tracecontext.c b/ltt/branches/poly/lttv/lttv/tracecontext.c index 395b3ab2..1c2a7f4d 100644 --- a/ltt/branches/poly/lttv/lttv/tracecontext.c +++ b/ltt/branches/poly/lttv/lttv/tracecontext.c @@ -45,13 +45,14 @@ gint compare_tracefile(gconstpointer a, gconstpointer b) } struct _LttvTraceContextPosition { - LttEventPosition **tf_pos; /* Position in each trace */ + LttEventPosition **tf_pos; /* Position in each tracefile */ guint nb_tracefile; /* Number of tracefiles (check) */ }; struct _LttvTracesetContextPosition { - LttvTraceContextPosition *t_pos; /* Position in each trace */ + LttvTraceContextPosition *t_pos; /* Position in each trace */ guint nb_trace; /* Number of traces (check) */ + LttTime timestamp; /* Current time at the saved position */ }; void lttv_context_init(LttvTracesetContext *self, LttvTraceset *ts) @@ -188,10 +189,10 @@ init(LttvTracesetContext *self, LttvTraceset *ts) tfc->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL); } } + self->pqueue = g_tree_new(compare_tracefile); lttv_process_traceset_seek_time(self, null_time); lttv_traceset_context_compute_time_span(self, &self->time_span); - self->pqueue = g_tree_new(compare_tracefile); } @@ -598,7 +599,7 @@ void lttv_process_traceset_begin(LttvTracesetContext *self, /* Note : a _middle must be preceded from a _seek or another middle */ guint lttv_process_traceset_middle(LttvTracesetContext *self, LttTime end, - unsigned nb_events, + guint nb_events, const LttvTracesetContextPosition *end_position) { GTree *pqueue = self->pqueue; @@ -637,8 +638,8 @@ guint lttv_process_traceset_middle(LttvTracesetContext *self, if(last_ret == TRUE || count >= nb_events || - lttv_traceset_context_ctx_pos_compare(self, - end_position) >= 0 || + (end_position!=NULL)?FALSE:lttv_traceset_context_ctx_pos_compare(self, + end_position) >= 0 || ltt_time_compare(tfc->timestamp, end) >= 0) { return count; @@ -860,6 +861,8 @@ void lttv_traceset_context_position_save(const LttvTracesetContext *self, LttEvent *event; + LttTime timestamp = self->time_span.end_time; + pos->nb_trace = nb_trace = lttv_traceset_number(self->ts); pos->t_pos = g_new(LttvTraceContextPosition, nb_trace); @@ -877,8 +880,11 @@ void lttv_traceset_context_position_save(const LttvTracesetContext *self, event = tfc->e; ltt_event_position(event, pos->t_pos[iter_trace].tf_pos[iter_tracefile]); + if(ltt_time_compare(tfc->timestamp, timestamp) < 0) + timestamp = tfc->timestamp; } } + pos->timestamp = timestamp; } void lttv_traceset_context_position_destroy(LttvTracesetContextPosition *pos) @@ -974,3 +980,19 @@ gint lttv_traceset_context_pos_pos_compare( } +LttTime lttv_traceset_context_position_get_time( + const LttvTracesetContextPosition *pos) +{ + return pos->timestamp; +} + + +LttvTracefileContext *lttv_traceset_context_get_current_tfc(LttvTracesetContext *self) +{ + GTree *pqueue = self->pqueue; + LttvTracefileContext *tfc; + + g_tree_foreach(pqueue, get_first, &tfc); + + return tfc; +}