X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fstate.c;h=bb221a77f99c49523164310bee3c0ddbbd159b40;hb=c6bc9cb9f0b1432775ddc7cbbd2f2c2cfdb28474;hp=2a9164caeb6da7ae0c311c788f952a364c397164;hpb=c432246e06bb83a3d43a6668517486fb6b4b959d;p=lttv.git diff --git a/ltt/branches/poly/lttv/state.c b/ltt/branches/poly/lttv/state.c index 2a9164ca..bb221a77 100644 --- a/ltt/branches/poly/lttv/state.c +++ b/ltt/branches/poly/lttv/state.c @@ -106,9 +106,9 @@ traceset_state_instance_init (GTypeInstance *instance, gpointer g_class) static void -traceset_state_finalize (LttvTracesetContext *self) +traceset_state_finalize (LttvTracesetState *self) { - G_OBJECT_CLASS(g_type_class_peek_parent(LTTV_TRACESET_STATE_GET_CLASS(self)))->finalize(G_OBJECT(self)); + G_OBJECT_CLASS(g_type_class_peek_parent(g_type_class_peek_parent(LTTV_TRACESET_STATE_GET_CLASS(self))))->finalize(G_OBJECT(self)); } @@ -157,9 +157,9 @@ trace_state_instance_init (GTypeInstance *instance, gpointer g_class) static void -trace_state_finalize (LttvTraceContext *self) +trace_state_finalize (LttvTraceState *self) { - G_OBJECT_CLASS(g_type_class_peek_parent(LTTV_TRACE_STATE_GET_CLASS(self)))->finalize(G_OBJECT(self)); + G_OBJECT_CLASS(g_type_class_peek_parent(g_type_class_peek_parent(LTTV_TRACE_STATE_GET_CLASS(self))))->finalize(G_OBJECT(self)); } @@ -184,7 +184,7 @@ lttv_trace_state_get_type(void) (GClassInitFunc) trace_state_class_init, /* class_init */ NULL, /* class_finalize */ NULL, /* class_data */ - sizeof (LttvTracesetState), + sizeof (LttvTraceState), 0, /* n_preallocs */ (GInstanceInitFunc) trace_state_instance_init /* instance_init */ }; @@ -205,7 +205,7 @@ tracefile_state_instance_init (GTypeInstance *instance, gpointer g_class) static void tracefile_state_finalize (LttvTracefileState *self) { - G_OBJECT_CLASS(g_type_class_peek_parent(LTTV_TRACEFILE_STATE_GET_CLASS(self)))->finalize(G_OBJECT(self)); + G_OBJECT_CLASS(g_type_class_peek_parent(g_type_class_peek_parent(LTTV_TRACEFILE_STATE_GET_CLASS(self))))->finalize(G_OBJECT(self)); } @@ -319,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; } @@ -561,36 +563,55 @@ 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); + +/* for now, in core facility there is no process_fork and process_exit event + 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++) { @@ -632,14 +653,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++) { @@ -647,12 +668,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); }