From fc6a87b233ef7a987817ab50aeec1342f5aee16f Mon Sep 17 00:00:00 2001 From: pmf Date: Tue, 31 Jul 2007 19:46:15 +0000 Subject: [PATCH] add state save/restore for irq handler resource fixes display bugs git-svn-id: http://ltt.polymtl.ca/svn@2572 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/lttv/lttv/state.c | 65 +++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 9 deletions(-) diff --git a/ltt/branches/poly/lttv/lttv/state.c b/ltt/branches/poly/lttv/lttv/state.c index 0c0a4cbc..58ae0a2f 100644 --- a/ltt/branches/poly/lttv/lttv/state.c +++ b/ltt/branches/poly/lttv/lttv/state.c @@ -163,7 +163,8 @@ static GQuark LTTV_STATE_HOOKS, LTTV_STATE_NAME_TABLES, LTTV_STATE_TRACE_STATE_USE_COUNT, - LTTV_STATE_RESOURCE_CPUS; + LTTV_STATE_RESOURCE_CPUS, + LTTV_STATE_RESOURCE_IRQS; static void create_max_time(LttvTraceState *tcs); @@ -1143,6 +1144,35 @@ static void lttv_state_free_cpu_states(LttvCPUState *states, guint n) g_free(states); } +static LttvIRQState *lttv_state_copy_irq_states(LttvIRQState *states, guint n) +{ + guint i,j; + LttvIRQState *retval; + + retval = g_malloc(n*sizeof(LttvIRQState)); + + for(i=0; ilen); + for(j=0; jlen; j++) { + g_array_index(retval[i].mode_stack, GQuark, j) = g_array_index(states[i].mode_stack, GQuark, j); + } + } + + return retval; +} + +static void lttv_state_free_irq_states(LttvIRQState *states, guint n) +{ + guint i; + + for(i=0; icpu_states, nb_cpus); + /* save the cpu state */ + { + guint size = sizeof(LttvCPUState)*nb_cpus; + value = lttv_attribute_add(container, LTTV_STATE_RESOURCE_CPUS, + LTTV_POINTER); + *(value.v_pointer) = lttv_state_copy_cpu_states(self->cpu_states, nb_cpus); + } + + /* save the irq state */ + nb_irqs = self->nb_irqs; + { + guint size = sizeof(LttvCPUState)*nb_irqs; + value = lttv_attribute_add(container, LTTV_STATE_RESOURCE_IRQS, + LTTV_POINTER); + *(value.v_pointer) = lttv_state_copy_irq_states(self->irq_states, nb_irqs); + } } static void state_restore(LttvTraceState *self, LttvAttribute *container) { - guint i, nb_tracefile, pid, nb_cpus; + guint i, nb_tracefile, pid, nb_cpus, nb_irqs; LttvTracefileState *tfcs; @@ -1274,8 +1316,6 @@ static void state_restore(LttvTraceState *self, LttvAttribute *container) g_assert(self->running_process[i] != NULL); } - printf("state restore\n"); - nb_tracefile = self->parent.tracefiles->len; //g_tree_destroy(tsc->pqueue); @@ -1287,6 +1327,13 @@ static void state_restore(LttvTraceState *self, LttvAttribute *container) lttv_state_free_cpu_states(self->cpu_states, nb_cpus); self->cpu_states = lttv_state_copy_cpu_states(*(value.v_pointer), nb_cpus); + /* restore irq resource states */ + nb_irqs = self->nb_irqs; + type = lttv_attribute_get_by_name(container, LTTV_STATE_RESOURCE_IRQS, &value); + g_assert(type == LTTV_POINTER); + lttv_state_free_irq_states(self->irq_states, nb_irqs); + self->irq_states = lttv_state_copy_irq_states(*(value.v_pointer), nb_irqs); + for(i = 0 ; i < nb_tracefile ; i++) { tfcs = LTTV_TRACEFILE_STATE(g_array_index(self->parent.tracefiles, -- 2.34.1