From: pmf Date: Fri, 30 May 2008 15:15:28 +0000 (+0000) Subject: state.c: track softirq raises X-Git-Tag: v0.12.20~558 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=a970363f31999693ffbc0d7d6cf8a15d03677d64;p=lttv.git state.c: track softirq raises git-svn-id: http://ltt.polymtl.ca/svn@2931 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/lttv/lttv/state.c b/ltt/branches/poly/lttv/lttv/state.c index b2fb55a3..3c73641d 100644 --- a/ltt/branches/poly/lttv/lttv/state.c +++ b/ltt/branches/poly/lttv/lttv/state.c @@ -65,6 +65,7 @@ GQuark LTT_EVENT_TRAP_EXIT, LTT_EVENT_IRQ_ENTRY, LTT_EVENT_IRQ_EXIT, + LTT_EVENT_SOFT_IRQ_RAISE, LTT_EVENT_SOFT_IRQ_ENTRY, LTT_EVENT_SOFT_IRQ_EXIT, LTT_EVENT_SCHED_SCHEDULE, @@ -430,6 +431,7 @@ restore_init_state(LttvTraceState *self) /* reset softirq states */ for(i=0; isoft_irq_states[i].pending = 0; self->soft_irq_states[i].running = 0; } @@ -1332,6 +1334,7 @@ static LttvSoftIRQState *lttv_state_copy_soft_irq_states(LttvSoftIRQState *state retval = g_new(LttvSoftIRQState, n); for(i=0; iparent.t_context; + LttEvent *e = ltt_tracefile_get_event(s->parent.tf); + //guint8 ev_id = ltt_event_eventtype_id(e); + LttvTraceHook *th = (LttvTraceHook *)hook_data; + struct marker_field *f = lttv_trace_get_hook_field(th, 0); + + LttvExecutionSubmode submode; + guint64 softirq = ltt_event_get_long_unsigned(e, f); + guint64 nb_softirqs = ((LttvTraceState *)(s->parent.t_context))->nb_soft_irqs; + + if(softirq < nb_softirqs) { + submode = ((LttvTraceState *)(s->parent.t_context))->soft_irq_names[softirq]; + } else { + /* Fixup an incomplete irq table */ + GString *string = g_string_new(""); + g_string_printf(string, "softirq %llu", softirq); + submode = g_quark_from_string(string->str); + g_string_free(string, TRUE); + } + + /* update softirq status */ + ts->soft_irq_states[softirq].pending++; + + return FALSE; +} + static gboolean soft_irq_entry(void *hook_data, void *call_data) { LttvTracefileState *s = (LttvTracefileState *)call_data; @@ -2551,6 +2583,8 @@ static gboolean soft_irq_entry(void *hook_data, void *call_data) /* update softirq status */ s->cpu_state->last_soft_irq = softirq; + if(ts->soft_irq_states[softirq].pending) + ts->soft_irq_states[softirq].pending--; ts->soft_irq_states[softirq].running++; return FALSE; @@ -3367,6 +3401,12 @@ void lttv_state_add_event_hooks(LttvTracesetState *self) NULL, irq_exit, NULL, &hooks); + lttv_trace_find_hook(ts->parent.t, + LTT_FACILITY_KERNEL, + LTT_EVENT_SOFT_IRQ_RAISE, + FIELD_ARRAY(LTT_FIELD_SOFT_IRQ_ID), + soft_irq_raise, NULL, &hooks); + lttv_trace_find_hook(ts->parent.t, LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_ENTRY, @@ -4151,6 +4191,7 @@ static void module_init() LTT_EVENT_TRAP_EXIT = g_quark_from_string("trap_exit"); LTT_EVENT_IRQ_ENTRY = g_quark_from_string("irq_entry"); LTT_EVENT_IRQ_EXIT = g_quark_from_string("irq_exit"); + LTT_EVENT_SOFT_IRQ_RAISE = g_quark_from_string("softirq_raise"); LTT_EVENT_SOFT_IRQ_ENTRY = g_quark_from_string("softirq_entry"); LTT_EVENT_SOFT_IRQ_EXIT = g_quark_from_string("softirq_exit"); LTT_EVENT_SCHED_SCHEDULE = g_quark_from_string("sched_schedule"); diff --git a/ltt/branches/poly/lttv/lttv/state.h b/ltt/branches/poly/lttv/lttv/state.h index 87a89b99..523e058b 100644 --- a/ltt/branches/poly/lttv/lttv/state.h +++ b/ltt/branches/poly/lttv/lttv/state.h @@ -73,6 +73,7 @@ extern GQuark LTT_EVENT_TRAP_EXIT, LTT_EVENT_IRQ_ENTRY, LTT_EVENT_IRQ_EXIT, + LTT_EVENT_SOFT_IRQ_RAISE, LTT_EVENT_SOFT_IRQ_ENTRY, LTT_EVENT_SOFT_IRQ_EXIT, LTT_EVENT_SCHED_SCHEDULE, @@ -326,6 +327,7 @@ typedef struct _LttvIRQState { } LttvIRQState; typedef struct _LttvSoftIRQState { + guint pending; /* number of times it is pending */ guint running; /* number of times it is currently running (on different processors) */ } LttvSoftIRQState;