From dd025f915d9b3a3e587578e97b3738115193c180 Mon Sep 17 00:00:00 2001 From: dagenais Date: Sat, 31 Jan 2004 17:20:11 +0000 Subject: [PATCH] New attributes to use or not saved state git-svn-id: http://ltt.polymtl.ca/svn@467 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/doc/developer/todo.html | 10 ++-- ltt/branches/poly/include/lttv/state.h | 6 ++- ltt/branches/poly/lttv/main/state.c | 64 +++++++++++++++-------- 3 files changed, 52 insertions(+), 28 deletions(-) diff --git a/ltt/branches/poly/doc/developer/todo.html b/ltt/branches/poly/doc/developer/todo.html index 675f3533..de0fcb4d 100644 --- a/ltt/branches/poly/doc/developer/todo.html +++ b/ltt/branches/poly/doc/developer/todo.html @@ -17,17 +17,19 @@ items.
  • Polish the visual appearance: icons for the tabs and buttons, background, lines and labels in the control flow viewer...
  • When a trace is opened, start a background thread to precompute - the system state after each ~100 000 events. Have the option to save - the precomputed state when a trace is closed. Use the precomputed - state if available when opening a trace or seeking in a trace. + the system state and memorize it after each ~100 000 events. + Have the option to save the precomputed state when a trace is closed. + Use the precomputed state if available when opening a trace or + seeking in a trace. Use the same thread for computing statistics.
  • Update module.c to ease changing a module into a builtin feature. +
  • Split processTrace into tracecontext and processtrace.
  • Insure that g_info logging is generally available but off by default.
  • Document each header file such that developer documentation can be extracted automatically using Doxygen.
  • Complete the user and developer documentation.
  • Test the viewer on large SMP traces. Insure that 2GB files do not cause - crashes. Note unduly long delays. + crashes. Note and fix unduly long delays. diff --git a/ltt/branches/poly/include/lttv/state.h b/ltt/branches/poly/include/lttv/state.h index bbebece0..8131bb8b 100644 --- a/ltt/branches/poly/include/lttv/state.h +++ b/ltt/branches/poly/include/lttv/state.h @@ -22,7 +22,7 @@ #include #include -/* The operating system state kept during the trace analysis +/* The operating system state, kept during the trace analysis, contains a subset of the real operating system state, sufficient for the analysis, and possibly organized quite differently. @@ -64,7 +64,7 @@ void lttv_state_save_add_event_hooks(LttvTracesetState *self); void lttv_state_save_remove_event_hooks(LttvTracesetState *self); -void lttv_state_restore_closest_state(LttvTracesetState *self, LttTime t); +void lttv_state_traceset_seek_time_closest(LttvTracesetState *self, LttTime t); /* The LttvProcessState structure defines the current state for each process. A process can make system calls (in some rare cases nested) and receive @@ -182,6 +182,8 @@ struct _LttvTraceState { GQuark *syscall_names; GQuark *trap_names; GQuark *irq_names; + gboolean recompute_state_in_seek; + gboolean saved_state_available; }; struct _LttvTraceStateClass { diff --git a/ltt/branches/poly/lttv/main/state.c b/ltt/branches/poly/lttv/main/state.c index 2a595f68..e6b6a78a 100644 --- a/ltt/branches/poly/lttv/main/state.c +++ b/ltt/branches/poly/lttv/main/state.c @@ -130,6 +130,8 @@ init(LttvTracesetState *self, LttvTraceset *ts) tc = self->parent.traces[i]; tcs = (LttvTraceState *)tc; tcs->save_interval = 100000; + tcs->recompute_state_in_seek = false; + tcs->saved_state_ready = false; fill_name_tables(tcs); nb_control = ltt_trace_control_tracefile_number(tc->t); @@ -983,7 +985,7 @@ void lttv_state_save_remove_event_hooks(LttvTracesetState *self) } -void lttv_state_restore_closest_state(LttvTracesetState *self, LttTime t) +void lttv_state_traceset_seek_time_closest(LttvTracesetState *self, LttTime t) { LttvTraceset *traceset = self->parent.ts; @@ -1005,31 +1007,49 @@ void lttv_state_restore_closest_state(LttvTracesetState *self, LttTime t) for(i = 0 ; i < nb_trace ; i++) { tcs = (LttvTraceState *)self->parent.traces[i]; - saved_states_tree = lttv_attribute_find_subdir(tcs->parent.t_a, - LTTV_STATE_SAVED_STATES); - min_pos = -1; - max_pos = lttv_attribute_get_number(saved_states_tree) - 1; - mid_pos = max_pos / 2; - while(min_pos < max_pos) { - type = lttv_attribute_get(saved_states_tree, mid_pos, &name, &value); - g_assert(type == LTTV_GOBJECT); - saved_state_tree = *((LttvAttribute **)(value.v_gobject)); - type = lttv_attribute_get_by_name(saved_state_tree, LTTV_STATE_TIME, - &value); - g_assert(type == LTTV_TIME); - if(ltt_time_compare(*(value.v_time), t) < 0) { - min_pos = mid_pos; - closest_tree = saved_state_tree; + if(tcs->recompute_state_in_seek) { + if(tcs->saved_state_available) { + saved_states_tree = lttv_attribute_find_subdir(tcs->parent.t_a, + LTTV_STATE_SAVED_STATES); + min_pos = -1; + max_pos = lttv_attribute_get_number(saved_states_tree) - 1; + mid_pos = max_pos / 2; + while(min_pos < max_pos) { + type = lttv_attribute_get(saved_states_tree, mid_pos, &name, &value); + g_assert(type == LTTV_GOBJECT); + saved_state_tree = *((LttvAttribute **)(value.v_gobject)); + type = lttv_attribute_get_by_name(saved_state_tree, LTTV_STATE_TIME, + &value); + g_assert(type == LTTV_TIME); + if(ltt_time_compare(*(value.v_time), t) < 0) { + min_pos = mid_pos; + closest_tree = saved_state_tree; + } + else max_pos = mid_pos - 1; + + mid_pos = (min_pos + max_pos + 1) / 2; + } + + /* restore the closest earlier saved state */ + if(min_pos != -1) lttv_state_restore(tcs, closest_tree); + + /* there is no earlier saved state, restart at T0 */ + else { + restore_init_state(tcs); + lttv_process_trace_seek_time(&(tcs->parent), ltt_time_zero); + } + + /* There is no saved state yet we want to have it. Restart at T0 */ + else { + restore_init_state(tcs); + lttv_process_trace_seek_time(&(tcs->parent), ltt_time_zero); } - else max_pos = mid_pos - 1; - mid_pos = (min_pos + max_pos + 1) / 2; - } - if(min_pos == -1) { + /* We want to seek quickly without restoring/updating the state */ + else { restore_init_state(tcs); - lttv_process_trace_seek_time(&(tcs->parent), ltt_time_zero); + lttv_process_trace_seek_time(&(tcs->parent), t); } - else lttv_state_restore(tcs, closest_tree); } } -- 2.34.1