From f57fd845a3c7c14f789a91cd70140d08632208ff Mon Sep 17 00:00:00 2001 From: pmf Date: Tue, 9 Oct 2007 02:04:23 +0000 Subject: [PATCH] tracecontext.c: start conversion git-svn-id: http://ltt.polymtl.ca/svn@2613 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/lttv/lttv/tracecontext.c | 60 +++++++++------------- ltt/branches/poly/lttv/lttv/tracecontext.h | 2 +- 2 files changed, 25 insertions(+), 37 deletions(-) diff --git a/ltt/branches/poly/lttv/lttv/tracecontext.c b/ltt/branches/poly/lttv/lttv/tracecontext.c index 8f1ad49b..a6ff811e 100644 --- a/ltt/branches/poly/lttv/lttv/tracecontext.c +++ b/ltt/branches/poly/lttv/lttv/tracecontext.c @@ -691,8 +691,6 @@ guint lttv_process_traceset_middle(LttvTracesetContext *self, { GTree *pqueue = self->pqueue; - guint fac_id, ev_id, id; - LttvTracefileContext *tfc; LttEvent *e; @@ -763,15 +761,12 @@ guint lttv_process_traceset_middle(LttvTracesetContext *self, * first pass (not if last read returned end of tracefile) */ count++; - 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 */ last_ret = lttv_hooks_call_merge(tfc->event, tfc, - lttv_hooks_by_id_get(tfc->event_by_id, id), tfc); + lttv_hooks_by_id_get(tfc->event_by_id, e->event_id), tfc); #if 0 /* This is buggy : it won't work well with state computation */ @@ -949,7 +944,7 @@ gboolean lttv_process_traceset_seek_position(LttvTracesetContext *self, } - +#if 0 // pmf: temporary disable static LttField * find_field(LttEventType *et, const GQuark field) { @@ -966,17 +961,11 @@ find_field(LttEventType *et, const GQuark field) return f; } +#endif -LttvTraceHookByFacility *lttv_trace_hook_get_fac(LttvTraceHook *th, - guint facility_id) -{ - return &g_array_index(th->fac_index, LttvTraceHookByFacility, facility_id); -} - -struct marker_info *lttv_trace_hook_get_marker(LttvTraceHook *th) +struct marker_info *lttv_trace_hook_get_marker(LttTrace *t, LttvTraceHook *th) { - g_assert(th->fac_list->len > 0); - return g_array_index(th->fac_list, LttvTraceHookByFacility*, 0); + return marker_get_info_from_id(t, th->id); } @@ -986,15 +975,15 @@ lttv_trace_find_hook(LttTrace *t, GQuark event, GQuark field1, GQuark field2, GQuark field3, LttvHook h, gpointer hook_data, LttvTraceHook *th) { - LttEventType *et, *first_et; +// LttEventType *et, *first_et; struct marker_info *info; guint i, ev_id; - head = marker_get_info_from_name(t, event); + info = marker_get_info_from_name(t, event); - if(unlikely(head == NULL)) + if(unlikely(info == NULL)) goto facility_error; ev_id = marker_get_id_from_info(t, info); @@ -1006,20 +995,20 @@ lttv_trace_find_hook(LttTrace *t, GQuark event, th->f3 = find_field(et, field3); th->hook_data = hook_data; - first_thf = thf; - first_et = et; +// first_thf = thf; +// first_et = et; /* Check for type compatibility too */ - for(i=1;ilen;i++) { - fac_id = g_array_index(facilities, guint, i); - f = ltt_trace_get_facility_by_num(t, fac_id); +// for(i=1;ilen;i++) { +// 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, event); - if(unlikely(et == NULL)) goto event_error; +// 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); - g_array_index(th->fac_list, LttvTraceHookByFacility*, i) = thf; - ev_id = ltt_eventtype_id(et); +// thf = &g_array_index(th->fac_index, LttvTraceHookByFacility, fac_id); +// g_array_index(th->fac_list, LttvTraceHookByFacility*, i) = thf; +// ev_id = ltt_eventtype_id(et); thf->h = h; thf->id = GET_HOOK_ID(fac_id, ev_id); thf->f1 = find_field(et, field1); @@ -1037,7 +1026,7 @@ lttv_trace_find_hook(LttTrace *t, GQuark event, first_thf->f3, thf->f3)) goto type_error; thf->hook_data = hook_data; - } +// } return 0; @@ -1052,17 +1041,16 @@ facility_error: //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); - th->fac_index = NULL; - th->fac_list = NULL; +// g_array_free(th->fac_index, TRUE); +// g_array_free(th->fac_list, TRUE); +// th->fac_index = NULL; +// th->fac_list = NULL; return -1; } void lttv_trace_hook_destroy(LttvTraceHook *th) { - g_array_free(th->fac_index, TRUE); - g_array_free(th->fac_list, TRUE); + // nothing to do } diff --git a/ltt/branches/poly/lttv/lttv/tracecontext.h b/ltt/branches/poly/lttv/lttv/tracecontext.h index a5630f8d..af650463 100644 --- a/ltt/branches/poly/lttv/lttv/tracecontext.h +++ b/ltt/branches/poly/lttv/lttv/tracecontext.h @@ -284,7 +284,7 @@ typedef struct _LttvTraceHook { /* Get the head of marker list correcponding to the given trace hook. */ -struct marker_info *lttv_trace_hook_get_marker(LttvTraceHook *th); +struct marker_info *lttv_trace_hook_get_marker(LttTrace *t, LttvTraceHook *th); void lttv_trace_hook_destroy(LttvTraceHook *th); -- 2.34.1