X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=sidebyside;f=ltt%2Fbranches%2Fpoly%2Flttv%2Flttv%2Ftracecontext.c;h=6f1e7b58a334665c1f1254cb9204d67c3bbb9c23;hb=f4b88a7dd49bfb6b88ea579410d7e4b59faaf73c;hp=fca7dacced0833b678476e9cf3b0565ee82e83dc;hpb=e7f5e89d1b5a36b99c24b738f446923a72966b3c;p=lttv.git diff --git a/ltt/branches/poly/lttv/lttv/tracecontext.c b/ltt/branches/poly/lttv/lttv/tracecontext.c index fca7dacc..6f1e7b58 100644 --- a/ltt/branches/poly/lttv/lttv/tracecontext.c +++ b/ltt/branches/poly/lttv/lttv/tracecontext.c @@ -764,7 +764,7 @@ guint lttv_process_traceset_middle(LttvTracesetContext *self, read_ret = ltt_tracefile_read(tfc->tf); if(likely(!read_ret)) { - g_debug("An event is ready"); + //g_debug("An event is ready"); tfc->timestamp = ltt_event_time(e); g_assert(ltt_time_compare(tfc->timestamp, ltt_time_infinite) != 0); g_tree_insert(pqueue, tfc, tfc); @@ -808,7 +808,10 @@ void lttv_process_traceset_end(LttvTracesetContext *self, /* Subtile modification : * if tracefile has no event at or after the time requested, it is not put in - * the queue, as the next read would fail. */ + * the queue, as the next read would fail. + * + * Don't forget to empty the traceset pqueue before calling this. + */ void lttv_process_trace_seek_time(LttvTraceContext *self, LttTime start) { guint i, nb_tracefile; @@ -819,9 +822,6 @@ void lttv_process_trace_seek_time(LttvTraceContext *self, LttTime start) nb_tracefile = self->tracefiles->len; - g_tree_destroy(self->ts_context->pqueue); - self->ts_context->pqueue = g_tree_new(compare_tracefile); - GTree *pqueue = self->ts_context->pqueue; for(i = 0 ; i < nb_tracefile ; i++) { @@ -858,6 +858,9 @@ void lttv_process_traceset_seek_time(LttvTracesetContext *self, LttTime start) LttvTraceContext *tc; + g_tree_destroy(self->pqueue); + self->pqueue = g_tree_new(compare_tracefile); + nb_trace = lttv_traceset_number(self->ts); for(i = 0 ; i < nb_trace ; i++) { tc = self->traces[i]; @@ -1004,7 +1007,7 @@ lttv_trace_find_hook(LttTrace *t, GQuark facility, GQuark event, fac_id = g_array_index(facilities, guint, i); f = ltt_trace_get_facility_by_num(t, fac_id); - et = ltt_facility_eventtype_get_by_name(f, ltt_eventtype_name(et)); + et = ltt_facility_eventtype_get_by_name(f, event); if(unlikely(et == NULL)) goto event_error; thf = &g_array_index(th->fac_index, LttvTraceHookByFacility, fac_id); @@ -1034,8 +1037,8 @@ lttv_trace_find_hook(LttTrace *t, GQuark facility, GQuark event, type_error: goto free; event_error: - g_error("Event type %s does not exist", - g_quark_to_string(ltt_eventtype_name(et))); + g_error("Event type does not exist for event %s", + g_quark_to_string(event)); goto free; facility_error: g_error("No %s facility", g_quark_to_string(facility)); @@ -1066,14 +1069,17 @@ LttvTracesetContextPosition *lttv_traceset_context_position_new() return pos; } -/* Save all positions, the ones not in the pqueue will have NULL +/* Save all positions, the ones with infinite time will have NULL * ep. */ void lttv_traceset_context_position_save(const LttvTracesetContext *self, LttvTracesetContextPosition *pos) { guint i; guint num_traces = lttv_traceset_number(self->ts); - + + pos->tfc = g_array_set_size(pos->tfc, 0); + pos->ep = g_array_set_size(pos->ep, 0); + for(i=0; itraces[i]->tracefiles; guint j; @@ -1122,8 +1128,8 @@ void lttv_traceset_context_position_copy(LttvTracesetContextPosition *dest, int i; LttEventPosition **src_ep, **dest_ep; - g_array_set_size(dest->ep, src->ep->len); - g_array_set_size(dest->tfc, src->tfc->len); + dest->ep = g_array_set_size(dest->ep, src->ep->len); + dest->tfc = g_array_set_size(dest->tfc, src->tfc->len); for(i=0;iep->len;i++) { src_ep = &g_array_index(src->ep, LttEventPosition*, i);