From 954417fa3ddedc1e88c6862dc4628aac9f395e3d Mon Sep 17 00:00:00 2001 From: compudj Date: Thu, 18 May 2006 18:39:53 +0000 Subject: [PATCH] fix the unknown time at beginning of trace : the world should turn round now git-svn-id: http://ltt.polymtl.ca/svn@1830 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/lttv/lttv/state.c | 5 +++- ltt/branches/poly/lttv/lttv/stats.c | 46 ++++++++++++++++++++++++----- 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/ltt/branches/poly/lttv/lttv/state.c b/ltt/branches/poly/lttv/lttv/state.c index 9201c818..e8bc78c1 100644 --- a/ltt/branches/poly/lttv/lttv/state.c +++ b/ltt/branches/poly/lttv/lttv/state.c @@ -203,6 +203,8 @@ restore_init_state(LttvTraceState *self) guint i, nb_cpus; LttvTracefileState *tfcs; + + LttTime start_time, end_time; /* Free the process tables */ if(self->processes != NULL) lttv_state_free_process_table(self->processes); @@ -218,6 +220,7 @@ restore_init_state(LttvTraceState *self) //g_tree_destroy(self->parent.ts_context->pqueue); //self->parent.ts_context->pqueue = g_tree_new(compare_tracefile); + ltt_trace_time_span_get(self->parent.t, &start_time, &end_time); //lttv_process_trace_seek_time(&self->parent, ltt_time_zero); @@ -226,7 +229,7 @@ restore_init_state(LttvTraceState *self) /* Put the per cpu running_process to beginning state : process 0. */ for(i=0; i< nb_cpus; i++) { self->running_process[i] = lttv_state_create_process(self, NULL, i, 0, - LTTV_STATE_UNNAMED, <t_time_zero); + LTTV_STATE_UNNAMED, &start_time); self->running_process[i]->state->s = LTTV_STATE_RUN; self->running_process[i]->cpu = i; } diff --git a/ltt/branches/poly/lttv/lttv/stats.c b/ltt/branches/poly/lttv/lttv/stats.c index 89da3046..7944bcd6 100644 --- a/ltt/branches/poly/lttv/lttv/stats.c +++ b/ltt/branches/poly/lttv/lttv/stats.c @@ -724,6 +724,20 @@ gboolean process_exit(void *hook_data, void *call_data) return FALSE; } +gboolean before_enum_process_state(void *hook_data, void *call_data) +{ + mode_end((LttvTracefileStats *)call_data); + after_mode_end((LttvTracefileStats *)call_data); + mode_change((LttvTracefileStats *)call_data); + return FALSE; +} + +gboolean after_enum_process_state(void *hook_data, void *call_data) +{ + update_event_tree((LttvTracefileStats *)call_data); + return FALSE; +} + gboolean process_free(void *hook_data, void *call_data) { return FALSE; @@ -1000,9 +1014,9 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *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), 11); - g_array_set_size(hooks, 11); - hn=0; + hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 12); + g_array_set_size(hooks, 12); + hn=0; ret = lttv_trace_find_hook(ts->parent.parent.t, LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_ENTRY, @@ -1080,14 +1094,22 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self) before_function_exit, NULL, &g_array_index(hooks, LttvTraceHook, hn++)); if(ret) hn--; - + + /* statedump-related hooks */ + ret = lttv_trace_find_hook(ts->parent.parent.t, + LTT_FACILITY_STATEDUMP, LTT_EVENT_ENUM_PROCESS_STATE, + LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME, + before_enum_process_state, NULL, + &g_array_index(hooks, LttvTraceHook, hn++)); + if(ret) hn--; + g_array_set_size(hooks, hn); before_hooks = hooks; - hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 14); - g_array_set_size(hooks, 14); - hn=0; + hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 15); + g_array_set_size(hooks, 15); + hn=0; ret = lttv_trace_find_hook(ts->parent.parent.t, LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_ENTRY, @@ -1186,7 +1208,15 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self) after_function_exit, NULL, &g_array_index(hooks, LttvTraceHook, hn++)); if(ret) hn--; - + + /* statedump-related hooks */ + ret = lttv_trace_find_hook(ts->parent.parent.t, + LTT_FACILITY_STATEDUMP, LTT_EVENT_ENUM_PROCESS_STATE, + LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME, + after_enum_process_state, NULL, + &g_array_index(hooks, LttvTraceHook, hn++)); + if(ret) hn--; + g_array_set_size(hooks, hn); after_hooks = hooks; -- 2.34.1