X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Flttv%2Ftracecontext.c;h=8634b1be564dc835ebddcac73495b71e586e6670;hb=78b82ded59fb3f65ed0829cd1cad36475ae4d0fb;hp=dd59a15a192332a9ae2f6fcf34a7586a05435458;hpb=565f24911d29ae5ca6bc096192df984fca27f902;p=lttv.git diff --git a/ltt/branches/poly/lttv/lttv/tracecontext.c b/ltt/branches/poly/lttv/lttv/tracecontext.c index dd59a15a..8634b1be 100644 --- a/ltt/branches/poly/lttv/lttv/tracecontext.c +++ b/ltt/branches/poly/lttv/lttv/tracecontext.c @@ -703,7 +703,7 @@ guint lttv_process_traceset_middle(LttvTracesetContext *self, //enum read_state last_read_state = LAST_NONE; - gboolean last_ret = FALSE; /* return value of the last hook list called */ + gint last_ret = 0; /* return value of the last hook list called */ /* Get the next event from the pqueue, call its hooks, reinsert in the pqueue the following event from the same tracefile @@ -766,11 +766,21 @@ 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); + /* Hooks : + * return values : 0 : continue read, 1 : go to next position and stop read, + * 2 : stay at the current position and stop read */ last_ret = lttv_hooks_call_merge(tfc->event, tfc, lttv_hooks_by_id_get(tfc->event_by_id, id), tfc); + + if(unlikely(last_ret == 2)) { + /* This is a case where we want to stay at this position and stop read. */ + g_tree_insert(pqueue, tfc, tfc); + return count - 1; + } read_ret = ltt_tracefile_read(tfc->tf); - + + if(likely(!read_ret)) { //g_debug("An event is ready"); tfc->timestamp = ltt_event_time(e); @@ -1543,12 +1553,13 @@ static gint seek_forward_event_hook(void *hook_data, void* call_data) return FALSE; } - sd->event_count++; if(sd->event_count >= sd->n) - return TRUE; - else + return 2; /* Stay at the same position */ + else { + sd->event_count++; return FALSE; + } } /* Seek back n events forward from the current position