X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fstate.c;h=794a94f66d4d5a6a100f21b31b061d78359496d1;hb=fe974fde3467cfd184c75d94222eed8c6af41052;hp=b60f22f23cfdda8a67c85a2237dcf71d14d260c5;hpb=ba576a781d5a1020ff7202ac9a959c9f4a0c7a4c;p=lttv.git diff --git a/ltt/branches/poly/lttv/state.c b/ltt/branches/poly/lttv/state.c index b60f22f2..794a94f6 100644 --- a/ltt/branches/poly/lttv/state.c +++ b/ltt/branches/poly/lttv/state.c @@ -78,21 +78,21 @@ fini(LttvTracesetState *self) } -LttvTracesetContext * +static LttvTracesetContext * new_traceset_context(LttvTracesetContext *self) { return LTTV_TRACESET_CONTEXT(g_object_new(LTTV_TRACESET_STATE_TYPE, NULL)); } -LttvTraceContext * +static LttvTraceContext * new_trace_context(LttvTracesetContext *self) { return LTTV_TRACE_CONTEXT(g_object_new(LTTV_TRACE_STATE_TYPE, NULL)); } -LttvTracefileContext * +static LttvTracefileContext * new_tracefile_context(LttvTracesetContext *self) { return LTTV_TRACEFILE_CONTEXT(g_object_new(LTTV_TRACEFILE_STATE_TYPE, NULL)); @@ -272,6 +272,7 @@ static void push_state(LttvTracefileState *tfs, LttvInterruptType t, intr->n = state_id; intr->entry = intr->last_change = LTTV_TRACEFILE_CONTEXT(tfs)->timestamp; intr->s = process->state->s; + process->state = intr; } @@ -318,6 +319,8 @@ LttvProcessState *create_process(LttvTracefileState *tfs, intr->entry = tfc->timestamp; intr->last_change = tfc->timestamp; intr->s = LTTV_STATE_WAIT_FORK; + + return process; } @@ -512,7 +515,7 @@ find_hook(LttTrace *t, char *facility, char *event, et = ltt_facility_eventtype_get_by_name(f, event); if(et == NULL) g_error("Event %s does not exist", event); - hook_id.id = *(ltt_eventtype_id(et)); /* CHECK */ + hook_id.id = ltt_eventtype_id(et); hook_id.h = h; hook_id.free_hook_data = FALSE; hook_data.f1 = find_field(et, field1); @@ -560,36 +563,54 @@ lttv_state_add_event_hooks(LttvTracesetState *self) associated by id hooks. */ hooks = g_array_new(FALSE, FALSE, sizeof(struct HookId)); - g_array_add(hooks, find_hook(ts->parent.t, "core","syscall_entry", - "syscall_id", NULL, NULL, syscall_entry)); - g_array_add(hooks, find_hook(ts->parent.t, "core", "syscall_exit", - NULL, NULL, NULL, syscall_exit)); - g_array_add(hooks, find_hook(ts->parent.t, "core", "trap_entry", "trap_id", - NULL, NULL, trap_entry)); - g_array_add(hooks, find_hook(ts->parent.t, "core", "trap_exit", NULL, NULL, - NULL, trap_exit)); - g_array_add(hooks, find_hook(ts->parent.t, "core", "irq_entry", "irq_id", - NULL, NULL, irq_entry)); - g_array_add(hooks, find_hook(ts->parent.t, "core", "irq_exit", NULL, NULL, - NULL, irq_exit)); - g_array_add(hooks, find_hook(ts->parent.t, "core", "schedchange", - "in", "out", "out_state", schedchange)); - g_array_add(hooks, find_hook(ts->parent.t, "core", "process_fork", - "child_pid", NULL, NULL, process_fork)); - g_array_add(hooks, find_hook(ts->parent.t, "core", "process_exit", - NULL, NULL, NULL, process_exit)); + hook_id = find_hook(ts->parent.t, "core","syscall_entry","syscall_id", + NULL, NULL, syscall_entry); + g_array_append_val(hooks, hook_id); + + hook_id = find_hook(ts->parent.t, "core", "syscall_exit", + NULL, NULL, NULL, syscall_exit); + g_array_append_val(hooks, hook_id); + + hook_id = find_hook(ts->parent.t, "core", "trap_entry", "trap_id", + NULL, NULL, trap_entry); + g_array_append_val(hooks, hook_id); + + hook_id = find_hook(ts->parent.t, "core", "trap_exit", NULL, NULL, + NULL, trap_exit); + g_array_append_val(hooks, hook_id); + + hook_id = find_hook(ts->parent.t, "core", "irq_entry", "irq_id", + NULL, NULL, irq_entry); + g_array_append_val(hooks, hook_id); + + hook_id = find_hook(ts->parent.t, "core", "irq_exit", NULL, NULL, + NULL, irq_exit); + g_array_append_val(hooks, hook_id); + + hook_id = find_hook(ts->parent.t, "core", "schedchange", + "in", "out", "out_state", schedchange); + g_array_append_val(hooks, hook_id); + + hook_id = find_hook(ts->parent.t, "core", "process_fork", + "child_pid", NULL, NULL, process_fork); + g_array_append_val(hooks, hook_id); + + hook_id = find_hook(ts->parent.t, "core", "process_exit", + NULL, NULL, NULL, process_exit); + g_array_append_val(hooks, hook_id); + /* Add these hooks to each before_event_by_id hooks list */ nb_control = ltt_trace_control_tracefile_number(ts->parent.t); - nb_per_cpu = ltt_trace_control_tracefile_number(ts->parent.t); + nb_per_cpu = ltt_trace_per_cpu_tracefile_number(ts->parent.t); nb_tracefile = nb_control + nb_per_cpu; for(j = 0 ; j < nb_tracefile ; j++) { if(j < nb_control) { tfs = LTTV_TRACEFILE_STATE(ts->parent.control_tracefiles[j]); } else { - tfs = LTTV_TRACEFILE_STATE(ts->parent.per_cpu_tracefiles[j]); + tfs = LTTV_TRACEFILE_STATE(ts->parent.per_cpu_tracefiles[j-nb_control]); } for(k = 0 ; k < hooks->len ; k++) { @@ -631,14 +652,14 @@ lttv_state_remove_event_hooks(LttvTracesetState *self) /* Add these hooks to each before_event_by_id hooks list */ nb_control = ltt_trace_control_tracefile_number(ts->parent.t); - nb_per_cpu = ltt_trace_control_tracefile_number(ts->parent.t); + nb_per_cpu = ltt_trace_per_cpu_tracefile_number(ts->parent.t); nb_tracefile = nb_control + nb_per_cpu; for(j = 0 ; j < nb_tracefile ; j++) { if(j < nb_control) { tfs = LTTV_TRACEFILE_STATE(ts->parent.control_tracefiles[j]); } else { - tfs = LTTV_TRACEFILE_STATE(ts->parent.per_cpu_tracefiles[j]); + tfs = LTTV_TRACEFILE_STATE(ts->parent.per_cpu_tracefiles[j-nb_control]); } for(k = 0 ; k < hooks->len ; k++) { @@ -646,12 +667,12 @@ lttv_state_remove_event_hooks(LttvTracesetState *self) lttv_hooks_remove_data( lttv_hooks_by_id_find(tfs->parent.before_event_by_id, hook_id.id), hook_id.h, hook_id.hook_data); - - } - for(k = 0 ; k < hooks->len ; k++) { - hook_id = g_array_index(hooks, struct HookId, k); if(hook_id.free_hook_data) g_free(hook_id.hook_data); } + // for(k = 0 ; k < hooks->len ; k++) { + // hook_id = g_array_index(hooks, struct HookId, k); + // if(hook_id.free_hook_data) g_free(hook_id.hook_data); + // } } g_array_free(hooks, TRUE); }