X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=lttv%2Flttv%2Fstate.c;h=25af4116000fc457adf4d7eff7f1d11b0f942bbd;hb=6d3ad1b2722e69f425f4d822f893c599c112cbc2;hp=2dde6de62a0ff2f5ddf85b417753ac7b90a071e7;hpb=068572ab11edc234542b5535259eb43db02df7ee;p=lttv.git diff --git a/lttv/lttv/state.c b/lttv/lttv/state.c index 2dde6de6..25af4116 100644 --- a/lttv/lttv/state.c +++ b/lttv/lttv/state.c @@ -2057,10 +2057,12 @@ create_name_tables(LttvTraceState *tcs) name_tables->irq_names[i] = g_quark_from_string(ltt_enum_string_get(t, i)); } */ + /* FIXME: LttvIRQState *irq_states should become a g_array */ + /* temp fix: increase from 256 to 512 default size */ - name_tables->nb_irqs = 256; - name_tables->irq_names = g_new(GQuark, 256); - for(i = 0 ; i < 256 ; i++) { + name_tables->nb_irqs = 512; + name_tables->irq_names = g_new(GQuark, 512); + for(i = 0 ; i < 512 ; i++) { g_string_printf(fe_name, "irq %d", i); name_tables->irq_names[i] = g_quark_from_string(fe_name->str); } @@ -2935,13 +2937,12 @@ static gboolean dump_softirq(void *hook_data, void *call_data) return FALSE; } -static gboolean sched_try_wakeup(void *hook_data, void *call_data) { - +static gboolean sched_try_wakeup(void *hook_data, void *call_data) +{ LttvTracefileState *s = (LttvTracefileState *)call_data; - LttvProcessState *process; - LttEvent *e = ltt_tracefile_get_event(s->parent.tf); LttvTraceHook *th = (LttvTraceHook *)hook_data; + LttvProcessState *process; gint woken_pid; guint woken_cpu; @@ -2958,7 +2959,6 @@ static gboolean sched_try_wakeup(void *hook_data, void *call_data) { g_debug("Wakeup: process %d on CPU %u\n", woken_pid, woken_cpu); return FALSE; - } static gboolean schedchange(void *hook_data, void *call_data) @@ -3313,6 +3313,25 @@ static gboolean fs_open(void *hook_data, void *call_data) return FALSE; } +static void print_stack(LttvProcessState *process) +{ + LttvExecutionState *es; + int i; + + g_debug("Execution stack for process %u %s:\n", + process->pid, g_quark_to_string(process->name)); + + for (i = 0; i < process->execution_stack->len; i++) { + es = &g_array_index(process->execution_stack, + LttvExecutionState, i); + g_debug("Depth %d mode %s submode %s status %s\n", + i, g_quark_to_string(es->t), + g_quark_to_string(es->n), + g_quark_to_string(es->s)); + } + +} + static void fix_process(gpointer key, gpointer value, gpointer user_data) { @@ -3321,6 +3340,8 @@ static void fix_process(gpointer key, gpointer value, process = (LttvProcessState *)value; LttTime *timestamp = (LttTime*)user_data; + print_stack(process); + if(process->type == LTTV_STATE_KERNEL_THREAD) { es = &g_array_index(process->execution_stack, LttvExecutionState, 0); if(es->t == LTTV_STATE_MODE_UNKNOWN) { @@ -3345,21 +3366,28 @@ static void fix_process(gpointer key, gpointer value, es->s = LTTV_STATE_RUN; if(process->execution_stack->len == 1) { - /* Still in bottom unknown mode, means never did a system call + /* Still in bottom unknown mode, means we either: + * - never did a system call + * - are scheduled out from user mode. * May be either in user mode, syscall mode, running or waiting.*/ - /* FIXME : we may be tagging syscall mode when being user mode */ - process->execution_stack = - g_array_set_size(process->execution_stack, 2); - es = process->state = &g_array_index(process->execution_stack, - LttvExecutionState, 1); - es->t = LTTV_STATE_SYSCALL; - es->n = LTTV_STATE_SUBMODE_NONE; - es->entry = *timestamp; - //g_assert(timestamp->tv_sec != 0); - es->change = *timestamp; - es->cum_cpu_time = ltt_time_zero; - if(es->s == LTTV_STATE_WAIT_FORK) - es->s = LTTV_STATE_WAIT; + /* CHECK : we may be tagging syscall mode when being user mode + * (should be fixed now) */ + if (es->s == LTTV_STATE_WAIT_CPU) { + /* nothing to do: scheduled out from userspace */ + } else { + process->execution_stack = + g_array_set_size(process->execution_stack, 2); + es = process->state = &g_array_index(process->execution_stack, + LttvExecutionState, 1); + es->t = LTTV_STATE_SYSCALL; + es->n = LTTV_STATE_SUBMODE_NONE; + es->entry = *timestamp; + //g_assert(timestamp->tv_sec != 0); + es->change = *timestamp; + es->cum_cpu_time = ltt_time_zero; + if(es->s == LTTV_STATE_WAIT_FORK) + es->s = LTTV_STATE_WAIT; + } } } }