X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Flttv%2Ftracecontext.c;h=5d24e11bc75f66e9c88d694b6867ae696bf9ca82;hb=ce05e1874c550fd8581bad2ff0c16858a544f9ed;hp=37147f8c32b35b45e5f97e11282e181c846c19e8;hpb=41b471e6cf2d1721e554517eefa332930bcf61e4;p=lttv.git diff --git a/ltt/branches/poly/lttv/lttv/tracecontext.c b/ltt/branches/poly/lttv/lttv/tracecontext.c index 37147f8c..5d24e11b 100644 --- a/ltt/branches/poly/lttv/lttv/tracecontext.c +++ b/ltt/branches/poly/lttv/lttv/tracecontext.c @@ -171,6 +171,7 @@ static void init_tracefile_context(LttTracefile *tracefile, tfc->event = lttv_hooks_new(); tfc->event_by_id = lttv_hooks_by_id_new(); tfc->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL); + tfc->target_pid = -1; } @@ -767,6 +768,7 @@ guint lttv_process_traceset_middle(LttvTracesetContext *self, fac_id = ltt_event_facility_id(e); ev_id = ltt_event_eventtype_id(e); id = GET_HOOK_ID(fac_id, ev_id); + tfc->target_pid = -1; /* unset target PID */ /* Hooks : * return values : 0 : continue read, 1 : go to next position and stop read, * 2 : stay at the current position and stop read */ @@ -1067,8 +1069,9 @@ event_error: g_quark_to_string(event)); goto free; facility_error: - g_error("No %s facility", g_quark_to_string(facility)); - goto free; + //Ignore this type of error : some facilities are not required. + //g_error("No %s facility", g_quark_to_string(facility)); + return -1; free: g_array_free(th->fac_index, TRUE); g_array_free(th->fac_list, TRUE); @@ -1335,6 +1338,9 @@ struct seek_back_data { guint n; /* number of events requested */ GPtrArray *array; /* array of LttvTracesetContextPositions pointers */ LttvFilter *filter; + check_handler *check; + gboolean *stop_flag; + guint raw_event_count; }; static gint seek_back_event_hook(void *hook_data, void* call_data) @@ -1344,6 +1350,9 @@ static gint seek_back_event_hook(void *hook_data, void* call_data) LttvTracesetContext *tsc = tfc->t_context->ts_context; LttvTracesetContextPosition *pos; + if(sd->check && sd->check(sd->raw_event_count, sd->stop_flag)) return TRUE; + sd->raw_event_count++; + if(sd->filter != NULL && sd->filter->head != NULL) { if(!lttv_filter_tree_parse(sd->filter->head, ltt_tracefile_get_event(tfc->tf), @@ -1395,7 +1404,9 @@ static gint seek_back_event_hook(void *hook_data, void* call_data) guint lttv_process_traceset_seek_n_backward(LttvTracesetContext *self, guint n, LttTime first_offset, seek_time_fct time_seeker, - LttvFilter *filter) + LttvFilter *filter, + check_handler *check, + gboolean *stop_flag) { if(lttv_traceset_number(self->ts) == 0) return 0; g_assert(ltt_time_compare(first_offset, ltt_time_zero) != 0); @@ -1418,6 +1429,9 @@ guint lttv_process_traceset_seek_n_backward(LttvTracesetContext *self, sd.array = g_ptr_array_sized_new(n); sd.filter = filter; sd.n = n; + sd.check = check; + sd.stop_flag = stop_flag; + sd.raw_event_count = 0; g_ptr_array_set_size(sd.array, n); for(i=0;icheck && sd->check(sd->raw_event_count, sd->stop_flag)) return TRUE; + sd->raw_event_count++; + if(sd->filter == NULL || lttv_filter_tree_parse(sd->filter->head, ltt_tracefile_get_event(tfc->tf), tfc->tf, @@ -1554,12 +1574,17 @@ static gint seek_forward_event_hook(void *hook_data, void* call_data) * returns : the number of events jumped over (may be less than requested if end * of traceset reached) */ guint lttv_process_traceset_seek_n_forward(LttvTracesetContext *self, - guint n, LttvFilter *filter) + guint n, LttvFilter *filter, + check_handler *check, + gboolean *stop_flag) { struct seek_forward_data sd; sd.event_count = 0; sd.n = n; sd.filter = filter; + sd.check = check; + sd.stop_flag = stop_flag; + sd.raw_event_count = 0; if(sd.event_count >= sd.n) return sd.event_count;