From 7bfd7820f2dc3f9a50ce8cab3ba97c728d1cc204 Mon Sep 17 00:00:00 2001 From: compudj Date: Mon, 27 Feb 2006 23:12:29 +0000 Subject: [PATCH] 0.8.23 git-svn-id: http://ltt.polymtl.ca/svn@1562 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/ChangeLog | 2 + ltt/branches/poly/configure.in | 2 +- ltt/branches/poly/doc/developer/format.html | 14 +++++ .../developer/lttng-lttv-compatibility.html | 1 + ltt/branches/poly/lttv/lttv/state.c | 53 ++++++++++++++++--- ltt/branches/poly/lttv/lttv/state.h | 2 + 6 files changed, 66 insertions(+), 8 deletions(-) diff --git a/ltt/branches/poly/ChangeLog b/ltt/branches/poly/ChangeLog index e65da2f3..04e35941 100644 --- a/ltt/branches/poly/ChangeLog +++ b/ltt/branches/poly/ChangeLog @@ -1,5 +1,7 @@ LinuxTraceToolkit ChangeLog +27/02/2006 LTTV 0.8.23 + Add kernel_thread information in state. 15/02/2006 LTTV 0.8.21 Add support for data with network byte order. 15/02/2006 LTTV 0.8.20 diff --git a/ltt/branches/poly/configure.in b/ltt/branches/poly/configure.in index 4b819f48..9877a4d9 100644 --- a/ltt/branches/poly/configure.in +++ b/ltt/branches/poly/configure.in @@ -23,7 +23,7 @@ AC_PREREQ(2.57) AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS) #AC_WITH_LTDL # not needed ? -AM_INIT_AUTOMAKE(LinuxTraceToolkitViewer,0.8.22-27022006) +AM_INIT_AUTOMAKE(LinuxTraceToolkitViewer,0.8.23-27022006) AM_CONFIG_HEADER(config.h) AM_PROG_LIBTOOL diff --git a/ltt/branches/poly/doc/developer/format.html b/ltt/branches/poly/doc/developer/format.html index 4f921530..b24e0c0a 100644 --- a/ltt/branches/poly/doc/developer/format.html +++ b/ltt/branches/poly/doc/developer/format.html @@ -377,6 +377,20 @@ following event types. </struct> </event> +<event name=state_dump_facility_load> + <description>Facility used in the trace</description> + <struct> + <field name="name"><string/></field> + <field name="checksum"><uint size=4/></field> + <field name="id"><uint size=4/></field> + <field name="int_size"><uint size=4/></field> + <field name="long_size"><uint size=4/></field> + <field name="pointer_size"><uint size=4/></field> + <field name="size_t_size"><uint size=4/></field> + <field name="has_alignment"><uint size=4/></field> + </struct> +</event> + <event name=time_heartbeat> <description>System time values sent periodically to minimize cycle counter drift with respect to real time clock and to detect cycle counter diff --git a/ltt/branches/poly/doc/developer/lttng-lttv-compatibility.html b/ltt/branches/poly/doc/developer/lttng-lttv-compatibility.html index 80de97cf..c1704233 100644 --- a/ltt/branches/poly/doc/developer/lttng-lttv-compatibility.html +++ b/ltt/branches/poly/doc/developer/lttng-lttv-compatibility.html @@ -301,6 +301,7 @@ Kernel State Dump : get vmaps, process names, fd at the beginning of a trace.
0.8.21
0.8.22
+0.8.23
0.5.20
diff --git a/ltt/branches/poly/lttv/lttv/state.c b/ltt/branches/poly/lttv/lttv/state.c index 05a6aa53..eba65ab8 100644 --- a/ltt/branches/poly/lttv/lttv/state.c +++ b/ltt/branches/poly/lttv/lttv/state.c @@ -54,6 +54,7 @@ GQuark LTT_EVENT_SOFT_IRQ_EXIT, LTT_EVENT_SCHEDCHANGE, LTT_EVENT_FORK, + LTT_EVENT_KERNEL_THREAD, LTT_EVENT_EXIT, LTT_EVENT_FREE, LTT_EVENT_EXEC, @@ -1017,6 +1018,8 @@ lttv_state_create_process(LttvTraceState *tcs, LttvProcessState *parent, process->name = name; //process->last_cpu = tfs->cpu_name; //process->last_cpu_index = ltt_tracefile_num(((LttvTracefileContext*)tfs)->tf); + process->kernel_thread = 0; + g_info("Process %u, core %p", process->pid, process); g_hash_table_insert(tcs->processes, process, process); @@ -1082,10 +1085,17 @@ lttv_state_find_process_or_create(LttvTraceState *ts, guint cpu, guint pid, LttTime *timestamp) { LttvProcessState *process = lttv_state_find_process(ts, cpu, pid); + LttvExecutionState *es; /* Put ltt_time_zero creation time for unexisting processes */ - if(unlikely(process == NULL)) process = lttv_state_create_process(ts, + if(unlikely(process == NULL)) { + process = lttv_state_create_process(ts, NULL, cpu, pid, LTTV_STATE_UNNAMED, timestamp); + /* We are not sure is it's a kernel thread or normal thread, put the + * bottom stack state to unknown */ + es = &g_array_index(process->execution_stack, LttvExecutionState, 0); + es->t = LTTV_STATE_MODE_UNKNOWN; + } return process; } @@ -1355,6 +1365,28 @@ static gboolean process_fork(void *hook_data, void *call_data) return FALSE; } +/* We stamp a newly created process as kernel_thread */ +static gboolean process_kernel_thread(void *hook_data, void *call_data) +{ + LttvTracefileState *s = (LttvTracefileState *)call_data; + LttEvent *e = ltt_tracefile_get_event(s->parent.tf); + LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data; + guint pid; + guint cpu = ltt_tracefile_num(s->parent.tf); + LttvTraceState *ts = (LttvTraceState*)s->parent.t_context; + LttvProcessState *process; + LttvExecutionState *es; + + /* PID */ + pid = ltt_event_get_unsigned(e, thf->f1); + + process = lttv_state_find_process(ts, ANY_CPU, pid); + es = &g_array_index(process->execution_stack, LttvExecutionState, 0); + es->t = LTTV_STATE_SYSCALL; + process->kernel_thread = 1; + + return FALSE; +} static gboolean process_exit(void *hook_data, void *call_data) { @@ -1575,8 +1607,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), 14); - hooks = g_array_set_size(hooks, 14); + hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 15); + hooks = g_array_set_size(hooks, 15); ret = lttv_trace_find_hook(ts->parent.t, LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_ENTRY, @@ -1638,29 +1670,35 @@ void lttv_state_add_event_hooks(LttvTracesetState *self) process_fork, NULL, &g_array_index(hooks, LttvTraceHook, 9)); g_assert(!ret); + ret = lttv_trace_find_hook(ts->parent.t, + LTT_FACILITY_PROCESS, LTT_EVENT_KERNEL_THREAD, + LTT_FIELD_PID, 0, 0, + process_kernel_thread, NULL, &g_array_index(hooks, LttvTraceHook, 10)); + g_assert(!ret); + ret = lttv_trace_find_hook(ts->parent.t, LTT_FACILITY_PROCESS, LTT_EVENT_EXIT, LTT_FIELD_PID, 0, 0, - process_exit, NULL, &g_array_index(hooks, LttvTraceHook, 10)); + process_exit, NULL, &g_array_index(hooks, LttvTraceHook, 11)); g_assert(!ret); ret = lttv_trace_find_hook(ts->parent.t, LTT_FACILITY_PROCESS, LTT_EVENT_FREE, LTT_FIELD_PID, 0, 0, - process_free, NULL, &g_array_index(hooks, LttvTraceHook, 11)); + process_free, NULL, &g_array_index(hooks, LttvTraceHook, 12)); 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, 12)); + process_exec, NULL, &g_array_index(hooks, LttvTraceHook, 13)); g_assert(!ret); /* statedump-related hooks */ ret = lttv_trace_find_hook(ts->parent.t, LTT_FACILITY_STATEDUMP, LTT_EVENT_ENUM_PROCESS_STATE, LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME, - enum_process_state, NULL, &g_array_index(hooks, LttvTraceHook, 13)); + enum_process_state, NULL, &g_array_index(hooks, LttvTraceHook, 14)); g_assert(!ret); @@ -2332,6 +2370,7 @@ static void module_init() LTT_EVENT_SOFT_IRQ_EXIT = g_quark_from_string("soft_irq_exit"); LTT_EVENT_SCHEDCHANGE = g_quark_from_string("schedchange"); LTT_EVENT_FORK = g_quark_from_string("fork"); + LTT_EVENT_KERNEL_THREAD = g_quark_from_string("kernel_thread"); LTT_EVENT_EXIT = g_quark_from_string("exit"); LTT_EVENT_FREE = g_quark_from_string("free"); LTT_EVENT_EXEC = g_quark_from_string("exec"); diff --git a/ltt/branches/poly/lttv/lttv/state.h b/ltt/branches/poly/lttv/lttv/state.h index f8d62d4c..c1095d80 100644 --- a/ltt/branches/poly/lttv/lttv/state.h +++ b/ltt/branches/poly/lttv/lttv/state.h @@ -75,6 +75,7 @@ extern GQuark LTT_EVENT_SOFT_IRQ_EXIT, LTT_EVENT_SCHEDCHANGE, LTT_EVENT_FORK, + LTT_EVENT_KERNEL_THREAD, LTT_EVENT_EXIT, LTT_EVENT_FREE, LTT_EVENT_EXEC, @@ -204,6 +205,7 @@ typedef struct _LttvProcessState { * (Mathieu) */ guint cpu; /* CPU where process is scheduled (being either in the active or inactive runqueue)*/ + gboolean kernel_thread; /* Is this thread a kernel_thread ? */ // guint last_tracefile_index; /* index in the trace for cpu tracefile */ /* opened file descriptors, address map?... */ } LttvProcessState; -- 2.34.1