From d052ffc307fc3321aeec9fc318ca300558dbc5f3 Mon Sep 17 00:00:00 2001 From: compudj Date: Sun, 21 Aug 2005 04:10:43 +0000 Subject: [PATCH] small fix to process_traceset middle : it won't stop if G_MAXULONG events requested git-svn-id: http://ltt.polymtl.ca/svn@1038 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/lttv/lttv/batchtest.c | 9 ++++-- ltt/branches/poly/lttv/lttv/hook.h | 3 ++ ltt/branches/poly/lttv/lttv/state.c | 32 ++++++---------------- ltt/branches/poly/lttv/lttv/stats.c | 12 ++++---- ltt/branches/poly/lttv/lttv/tracecontext.c | 11 +++++--- 5 files changed, 31 insertions(+), 36 deletions(-) diff --git a/ltt/branches/poly/lttv/lttv/batchtest.c b/ltt/branches/poly/lttv/lttv/batchtest.c index 8bb37438..7dc1771c 100644 --- a/ltt/branches/poly/lttv/lttv/batchtest.c +++ b/ltt/branches/poly/lttv/lttv/batchtest.c @@ -282,6 +282,7 @@ static void compute_tracefile(LttTracefile *tracefile, void *hook_data) sanitize_name(mod_name); + g_warning("test %s test", g_quark_to_string(ltt_tracefile_name(tracefile))); g_string_printf(filename, "%s.%s.%u.trace", a_dump_tracefiles, mod_name, ltt_tracefile_num(tracefile)); fp = fopen(filename->str, "w"); @@ -310,9 +311,13 @@ static void compute_tracefile(LttTracefile *tracefile, void *hook_data) g_quark_to_string(ltt_tracefile_name(tracefile))); if(ltt_time_compare(time, previous_time) < 0) { - g_warning("Time decreasing trace %s tracefile %s position %u/%u", + g_warning("Time decreasing trace %s tracefile %s cpu %u position %u/%u", g_quark_to_string(ltt_trace_name(ltt_tracefile_get_trace(tracefile))), - g_quark_to_string(ltt_tracefile_name(tracefile)), nb_block, offset); + g_quark_to_string(ltt_tracefile_name(tracefile)), + ltt_tracefile_num(tracefile), nb_block, offset); + g_warning("last time %lu.%lu vs current %lu.%lu", + previous_time.tv_sec, previous_time.tv_nsec, + time.tv_sec, time.tv_nsec); } #if 0 //FIXME diff --git a/ltt/branches/poly/lttv/lttv/hook.h b/ltt/branches/poly/lttv/lttv/hook.h index b62ddcfc..90f50b0d 100644 --- a/ltt/branches/poly/lttv/lttv/hook.h +++ b/ltt/branches/poly/lttv/lttv/hook.h @@ -128,6 +128,9 @@ typedef struct _LttvHooksById { GArray *array; } LttvHooksById; +/* macro to calculate the hook ID of a facility/event pair. */ +#define GET_HOOK_ID(fac_id, ev_id) \ + ( (guint)fac_id | ((guint)ev_id << (8*sizeof(NUM_FACILITIES))) ) /* Create and destroy a hooks by id list */ diff --git a/ltt/branches/poly/lttv/lttv/state.c b/ltt/branches/poly/lttv/lttv/state.c index 95d6a5a5..f2af9a37 100644 --- a/ltt/branches/poly/lttv/lttv/state.c +++ b/ltt/branches/poly/lttv/lttv/state.c @@ -968,9 +968,7 @@ static gboolean syscall_entry(void *hook_data, void *call_data) { LttvTracefileState *s = (LttvTracefileState *)call_data; LttEvent *e = ltt_tracefile_get_event(s->parent.tf); - LttvTraceHookByFacility *thf = - lttv_trace_hook_get_fac((LttvTraceHook *)hook_data, - ltt_event_facility_id(e)); + LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data; LttField *f = thf->f1; LttvExecutionSubmode submode; @@ -995,9 +993,7 @@ static gboolean trap_entry(void *hook_data, void *call_data) { LttvTracefileState *s = (LttvTracefileState *)call_data; LttEvent *e = ltt_tracefile_get_event(s->parent.tf); - LttvTraceHookByFacility *thf = - lttv_trace_hook_get_fac((LttvTraceHook *)hook_data, - ltt_event_facility_id(e)); + LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data; LttField *f = thf->f1; LttvExecutionSubmode submode; @@ -1024,9 +1020,7 @@ static gboolean irq_entry(void *hook_data, void *call_data) LttEvent *e = ltt_tracefile_get_event(s->parent.tf); guint8 fac_id = ltt_event_facility_id(e); guint8 ev_id = ltt_event_eventtype_id(e); - LttvTraceHookByFacility *thf = - lttv_trace_hook_get_fac((LttvTraceHook *)hook_data, - ltt_event_facility_id(e)); + LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data; // g_assert(lttv_trace_hook_get_first((LttvTraceHook *)hook_data)->f1 != NULL); g_assert(thf->f1 != NULL); // g_assert(thf == lttv_trace_hook_get_first((LttvTraceHook *)hook_data)); @@ -1056,9 +1050,7 @@ static gboolean schedchange(void *hook_data, void *call_data) { LttvTracefileState *s = (LttvTracefileState *)call_data; LttEvent *e = ltt_tracefile_get_event(s->parent.tf); - LttvTraceHookByFacility *thf = - lttv_trace_hook_get_fac((LttvTraceHook *)hook_data, - ltt_event_facility_id(e)); + LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data; guint pid_in, pid_out, state_out; pid_out = ltt_event_get_unsigned(e, thf->f1); @@ -1104,9 +1096,7 @@ static gboolean process_fork(void *hook_data, void *call_data) { LttvTracefileState *s = (LttvTracefileState *)call_data; LttEvent *e = ltt_tracefile_get_event(s->parent.tf); - LttvTraceHookByFacility *thf = - lttv_trace_hook_get_fac((LttvTraceHook *)hook_data, - ltt_event_facility_id(e)); + LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data; LttField *f; guint parent_pid; guint child_pid; @@ -1141,9 +1131,7 @@ static gboolean process_exit(void *hook_data, void *call_data) { LttvTracefileState *s = (LttvTracefileState *)call_data; LttEvent *e = ltt_tracefile_get_event(s->parent.tf); - LttvTraceHookByFacility *thf = - lttv_trace_hook_get_fac((LttvTraceHook *)hook_data, - ltt_event_facility_id(e)); + LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data; LttField *f; guint pid; @@ -1162,9 +1150,7 @@ static gboolean process_free(void *hook_data, void *call_data) { LttvTracefileState *s = (LttvTracefileState *)call_data; LttEvent *e = ltt_tracefile_get_event(s->parent.tf); - LttvTraceHookByFacility *thf = - lttv_trace_hook_get_fac((LttvTraceHook *)hook_data, - ltt_event_facility_id(e)); + LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data; guint release_pid; LttvProcessState *process; @@ -1298,7 +1284,7 @@ void lttv_state_add_event_hooks(LttvTracesetState *self) lttv_hooks_add( lttv_hooks_by_id_find(tfs->parent.event_by_id, thf->id), thf->h, - hook, + thf, LTTV_PRIO_STATE); } } @@ -1358,7 +1344,7 @@ void lttv_state_remove_event_hooks(LttvTracesetState *self) lttv_hooks_remove_data( lttv_hooks_by_id_find(tfs->parent.event_by_id, thf->id), thf->h, - &g_array_index(hooks, LttvTraceHook, k)); + thf); } lttv_trace_hook_destroy(&g_array_index(hooks, LttvTraceHook, k)); } diff --git a/ltt/branches/poly/lttv/lttv/stats.c b/ltt/branches/poly/lttv/lttv/stats.c index d5b4f5e6..fd7b13a8 100644 --- a/ltt/branches/poly/lttv/lttv/stats.c +++ b/ltt/branches/poly/lttv/lttv/stats.c @@ -522,9 +522,7 @@ gboolean before_schedchange(void *hook_data, void *call_data) LttEvent *e = ltt_tracefile_get_event(tfcs->parent.parent.tf); - LttvTraceHookByFacility *thf = - lttv_trace_hook_get_fac((LttvTraceHook *)hook_data, - ltt_event_facility_id(e)); + LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data; guint pid_in, pid_out, state_out; @@ -902,7 +900,7 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self) lttv_hooks_add( lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, thf->id), thf->h, - &g_array_index(before_hooks, LttvTraceHook, k), + thf, LTTV_PRIO_STATS_BEFORE_STATE); } } @@ -913,7 +911,7 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self) lttv_hooks_add( lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, thf->id), thf->h, - &g_array_index(after_hooks, LttvTraceHook, k), + thf, LTTV_PRIO_STATS_AFTER_STATE); } } @@ -984,7 +982,7 @@ void lttv_stats_remove_event_hooks(LttvTracesetStats *self) lttv_hooks_remove_data( lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, thf->id), thf->h, - &g_array_index(before_hooks, LttvTraceHook, k)); + thf); } } for(k = 0 ; k < after_hooks->len ; k++) { @@ -994,7 +992,7 @@ void lttv_stats_remove_event_hooks(LttvTracesetStats *self) lttv_hooks_remove_data( lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, thf->id), thf->h, - &g_array_index(after_hooks, LttvTraceHook, k)); + thf); } } } diff --git a/ltt/branches/poly/lttv/lttv/tracecontext.c b/ltt/branches/poly/lttv/lttv/tracecontext.c index 28c27967..2a813151 100644 --- a/ltt/branches/poly/lttv/lttv/tracecontext.c +++ b/ltt/branches/poly/lttv/lttv/tracecontext.c @@ -679,7 +679,7 @@ guint lttv_process_traceset_middle(LttvTracesetContext *self, */ if(unlikely(last_ret == TRUE || - count >= nb_events || + ((count >= nb_events) && (nb_events != G_MAXULONG)) || (end_position!=NULL&<tv_traceset_context_ctx_pos_compare(self, end_position) == 0)|| ltt_time_compare(end, tfc->timestamp) <= 0)) @@ -844,7 +844,7 @@ lttv_trace_find_hook(LttTrace *t, GQuark facility, GQuark event, GArray *facilities; - guint i, fac_id; + guint i, fac_id, ev_id; LttvTraceHookByFacility *thf, *first_thf; @@ -872,8 +872,10 @@ lttv_trace_find_hook(LttTrace *t, GQuark facility, GQuark event, g_array_index(th->fac_list, LttvTraceHookByFacility*, 0) = thf; + ev_id = ltt_eventtype_id(et); + thf->h = h; - thf->id = ltt_eventtype_id(et); + thf->id = GET_HOOK_ID(fac_id, ev_id); thf->f1 = find_field(et, field1); thf->f2 = find_field(et, field2); thf->f3 = find_field(et, field3); @@ -891,8 +893,9 @@ lttv_trace_find_hook(LttTrace *t, GQuark facility, GQuark event, 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 = ltt_eventtype_id(et); + thf->id = GET_HOOK_ID(fac_id, ev_id); thf->f1 = find_field(et, field1); if(check_fields_compatibility(first_et, et, first_thf->f1, thf->f1)) -- 2.34.1