X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Flttv%2Fstate.c;h=49fdf382c64aeb016e3120fb2a15d793846442cc;hb=33e44b82c5966a1841044f9ad87485054a39df7e;hp=a59ac339bc35affc10385447ba07a11cab89ed39;hpb=728d0c3ea0f5f236770ac2f330dccada59c59366;p=lttv.git diff --git a/ltt/branches/poly/lttv/lttv/state.c b/ltt/branches/poly/lttv/lttv/state.c index a59ac339..49fdf382 100644 --- a/ltt/branches/poly/lttv/lttv/state.c +++ b/ltt/branches/poly/lttv/lttv/state.c @@ -35,7 +35,8 @@ GQuark LTT_FACILITY_KERNEL, - LTT_FACILITY_PROCESS; + LTT_FACILITY_PROCESS, + LTT_FACILITY_FS; /* Events Quarks */ @@ -49,7 +50,8 @@ GQuark LTT_EVENT_SCHEDCHANGE, LTT_EVENT_FORK, LTT_EVENT_EXIT, - LTT_EVENT_FREE; + LTT_EVENT_FREE, + LTT_EVENT_EXEC; /* Fields Quarks */ @@ -62,7 +64,8 @@ GQuark LTT_FIELD_OUT_STATE, LTT_FIELD_PARENT_PID, LTT_FIELD_CHILD_PID, - LTT_FIELD_PID; + LTT_FIELD_PID, + LTT_FIELD_FILENAME; LttvExecutionMode LTTV_STATE_MODE_UNKNOWN, @@ -1273,12 +1276,39 @@ static gboolean process_free(void *hook_data, void *call_data) if(likely(process != NULL)) { /* release_task is happening at kernel level : we can now safely release * the data structure of the process */ + guint num_cpus = ltt_trace_get_num_cpu(ts->parent.t); + guint i; + for(i=0; i< num_cpus; i++) { + g_assert(process != ts->running_process[i]); + } exit_process(s, process); } return FALSE; } + +static gboolean process_exec(void *hook_data, void *call_data) +{ + LttvTracefileState *s = (LttvTracefileState *)call_data; + LttvTraceState *ts = (LttvTraceState*)s->parent.t_context; + LttEvent *e = ltt_tracefile_get_event(s->parent.tf); + LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data; + gchar *name; + guint cpu = ltt_tracefile_num(s->parent.tf); + LttvProcessState *process = ts->running_process[cpu]; + + /* PID of the process to release */ + name = ltt_event_get_string(e, thf->f1); + + process->name = g_quark_from_string(name); + + return FALSE; +} + + + + gint lttv_state_hook_add_event_hooks(void *hook_data, void *call_data) { LttvTracesetState *tss = (LttvTracesetState*)(call_data); @@ -1315,8 +1345,8 @@ void lttv_state_add_event_hooks(LttvTracesetState *self) /* Find the eventtype id for the following events and register the associated by id hooks. */ - hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 10); - hooks = g_array_set_size(hooks, 10); + hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 11); + hooks = g_array_set_size(hooks, 11); ret = lttv_trace_find_hook(ts->parent.t, LTT_FACILITY_KERNEL, LTT_EVENT_SYSCALL_ENTRY, @@ -1378,6 +1408,13 @@ void lttv_state_add_event_hooks(LttvTracesetState *self) process_free, NULL, &g_array_index(hooks, LttvTraceHook, 9)); g_assert(!ret); + ret = lttv_trace_find_hook(ts->parent.t, + LTT_FACILITY_FS, LTT_EVENT_EXEC, + LTT_FIELD_FILENAME, 0, 0, + process_exec, NULL, &g_array_index(hooks, LttvTraceHook, 10)); + g_assert(!ret); + + /* Add these hooks to each event_by_id hooks list */ @@ -1414,7 +1451,6 @@ gint lttv_state_hook_remove_event_hooks(void *hook_data, void *call_data) return 0; } -static guint test_event_count = 0; void lttv_state_remove_event_hooks(LttvTracesetState *self) { LttvTraceset *traceset = self->parent.ts; @@ -1464,14 +1500,12 @@ void lttv_state_remove_event_hooks(LttvTracesetState *self) lttv_trace_hook_destroy(&g_array_index(hooks, LttvTraceHook, k)); g_array_free(hooks, TRUE); } - g_info("EVENT COUNT TEST : %u", test_event_count); } static gboolean state_save_event_hook(void *hook_data, void *call_data) { guint *event_count = (guint*)hook_data; - test_event_count++; /* Only save at LTTV_STATE_SAVE_INTERVAL */ if(likely((*event_count)++ < LTTV_STATE_SAVE_INTERVAL)) return FALSE; @@ -2009,6 +2043,7 @@ static void module_init() LTT_FACILITY_KERNEL = g_quark_from_string("kernel"); LTT_FACILITY_PROCESS = g_quark_from_string("process"); + LTT_FACILITY_FS = g_quark_from_string("fs"); LTT_EVENT_SYSCALL_ENTRY = g_quark_from_string("syscall_entry"); @@ -2021,6 +2056,7 @@ static void module_init() LTT_EVENT_FORK = g_quark_from_string("fork"); LTT_EVENT_EXIT = g_quark_from_string("exit"); LTT_EVENT_FREE = g_quark_from_string("free"); + LTT_EVENT_EXEC = g_quark_from_string("exec"); LTT_FIELD_SYSCALL_ID = g_quark_from_string("syscall_id"); @@ -2032,6 +2068,7 @@ static void module_init() LTT_FIELD_PARENT_PID = g_quark_from_string("parent_pid"); LTT_FIELD_CHILD_PID = g_quark_from_string("child_pid"); LTT_FIELD_PID = g_quark_from_string("pid"); + LTT_FIELD_FILENAME = g_quark_from_string("filename"); }