From: Yannick Brosseau Date: Fri, 3 Aug 2012 13:41:53 +0000 (-0400) Subject: Reactivate state checkpoints X-Git-Tag: v1.5-beta1~53 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=58b4e4ae6fe118dbf6b441692eae833df2229d3e;p=lttv.git Reactivate state checkpoints Port lttv_state_traceset_seek_time_closest and add seek helper functions Currently the checkpoints are computed at trace addition in the foreground Signed-off-by: Yannick Brosseau --- diff --git a/lttv/lttv/state.c b/lttv/lttv/state.c index fc9bcac1..ffe3ba1a 100644 --- a/lttv/lttv/state.c +++ b/lttv/lttv/state.c @@ -1683,7 +1683,7 @@ void lttv_state_saved_free(LttvTraceState *self, LttvAttribute *container) running_process = *(value.v_pointer); g_free(running_process); - /* free cpu resource states */ + /* free cpu resources */ type = lttv_attribute_get_by_name(container, LTTV_STATE_RESOURCE_CPUS_COUNT, &value); g_assert(type == LTTV_UINT); nb_cpus = *value.v_uint; @@ -2793,8 +2793,8 @@ static gboolean schedchange(void *hook_data, void *call_data) cpu = lttv_traceset_get_cpuid_from_event(event); ts = event->state; process = ts->running_process[cpu]; - pid_out = lttv_event_get_long_unsigned(event, "prev_tid"); - pid_in = lttv_event_get_long_unsigned(event, "next_tid"); + pid_out = lttv_event_get_long(event, "prev_tid"); + pid_in = lttv_event_get_long(event, "next_tid"); state_out = lttv_event_get_long(event, "prev_state"); strncpy(next_comm, lttv_event_get_string(event, "next_comm"), 20); @@ -3714,34 +3714,53 @@ void lttv_state_add_event_hooks(LttvTraceset *traceset) gint lttv_state_hook_remove_event_hooks(void *hook_data, void *call_data) { - //TODO ybrosseau 2012-05-11 Reactivate the remove -#if 0 - LttvTracesetState *tss = (LttvTracesetState*)(call_data); - lttv_state_remove_event_hooks(tss); -#endif + LttvTraceset *traceset = (LttvTraceset*)(call_data); + + lttv_state_remove_event_hooks(traceset); + return 0; } -#if 0 -void lttv_state_remove_event_hooks(LttvTracesetState *self) + +void lttv_state_remove_event_hooks(LttvTraceset *traceset) { - LttvTraceset *traceset = self->parent.ts; guint i, j, k, nb_trace, nb_tracefile; - LttvTraceState *ts; + //LttvTraceState *ts; - LttvTracefileState *tfs; + //GArray *hooks; - GArray *hooks; + //LttvTraceHook *th; - LttvTraceHook *th; + //LttvAttributeValue val; - LttvAttributeValue val; + LttvHooks*event_hook; + //TODO ybrosseau 2012-07-17 validate this. Reversed what's done in the add + event_hook = lttv_traceset_get_hooks(traceset); + g_assert(event_hook); + + + lttv_hooks_remove(event_hook,syscall_entry ); + lttv_hooks_remove(event_hook,syscall_exit); + lttv_hooks_remove(event_hook,irq_entry ); + lttv_hooks_remove(event_hook,irq_exit ); + lttv_hooks_remove(event_hook,soft_irq_raise); + lttv_hooks_remove(event_hook,soft_irq_entry); + lttv_hooks_remove(event_hook,soft_irq_exit); + lttv_hooks_remove(event_hook,schedchange); + lttv_hooks_remove(event_hook,sched_try_wakeup); + lttv_hooks_remove(event_hook,process_exit); + lttv_hooks_remove(event_hook,process_free); + lttv_hooks_remove(event_hook,process_exec); + lttv_hooks_remove(event_hook,enum_process_state); + lttv_hooks_remove(event_hook,statedump_end); + lttv_hooks_remove(event_hook,enum_interrupt); +#ifdef BABEL_CLEANUP nb_trace = lttv_traceset_number(traceset); for(i = 0 ; i < nb_trace ; i++) { - ts = LTTV_TRACE_STATE(self->parent.traces[i]); + ts = lttv_traceset_get(i); lttv_attribute_find(ts->parent.a, LTTV_STATE_HOOKS, LTTV_POINTER, &val); hooks = *(val.v_pointer); @@ -3767,9 +3786,10 @@ void lttv_state_remove_event_hooks(LttvTracesetState *self) lttv_trace_hook_remove_all(&hooks); g_array_free(hooks, TRUE); } -} #endif -#ifdef BABEL_CLEANUP +} + + static gboolean state_save_event_hook(void *hook_data, void *call_data) { guint *event_count = (guint*)hook_data; @@ -3780,40 +3800,54 @@ static gboolean state_save_event_hook(void *hook_data, void *call_data) else *event_count = 0; - LttvTracefileState *self = (LttvTracefileState *)call_data; + LttvEvent *event = (LttvEvent *)call_data; - LttvTraceState *tcs = (LttvTraceState *)(self->parent.t_context); + LttvTraceset *traceset = lttv_trace_get_traceset(event->state->trace); LttvAttribute *saved_states_tree, *saved_state_tree; LttvAttributeValue value; + LttTime currentTime; + guint i; + currentTime = lttv_event_get_timestamp(event); + int nb_trace = lttv_traceset_number(traceset); + for(i = 0 ; i < nb_trace ; i++) { - saved_states_tree = lttv_attribute_find_subdir(tcs->parent.t_a, - LTTV_STATE_SAVED_STATES); - saved_state_tree = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL); - value = lttv_attribute_add(saved_states_tree, - lttv_attribute_get_number(saved_states_tree), LTTV_GOBJECT); - *(value.v_gobject) = (GObject *)saved_state_tree; - value = lttv_attribute_add(saved_state_tree, LTTV_STATE_TIME, LTTV_TIME); - *(value.v_time) = self->parent.timestamp; - lttv_state_save(tcs, saved_state_tree); - g_debug("Saving state at time %lu.%lu", self->parent.timestamp.tv_sec, - self->parent.timestamp.tv_nsec); + LttvTrace *trace = lttv_traceset_get(traceset, i); + LttvTraceState *tstate = trace->state; + saved_states_tree = lttv_attribute_find_subdir(trace->a, + LTTV_STATE_SAVED_STATES); + + saved_state_tree = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL); + value = lttv_attribute_add(saved_states_tree, + lttv_attribute_get_number(saved_states_tree), LTTV_GOBJECT); + *(value.v_gobject) = (GObject *)saved_state_tree; - *(tcs->max_time_state_recomputed_in_seek) = self->parent.timestamp; + value = lttv_attribute_add(saved_state_tree, LTTV_STATE_TIME, LTTV_TIME); + *(value.v_time) = currentTime; + + lttv_state_save(tstate, saved_state_tree); + g_debug("Saving state at time %lu.%lu", currentTime.tv_sec, + currentTime.tv_nsec); + + *(tstate->max_time_state_recomputed_in_seek) = currentTime; + } return FALSE; } static gboolean state_save_after_trace_hook(void *hook_data, void *call_data) { - LttvTraceState *tcs = (LttvTraceState *)(call_data); +#warning "Would we move max_time to traceset" + LttvTrace *trace = (LttvTrace *)(call_data); + LttvTraceState *tcs = trace->state; + TimeInterval time_span = lttv_traceset_get_time_span_real(lttv_trace_get_traceset(trace)); - *(tcs->max_time_state_recomputed_in_seek) = tcs->parent.time_span.end_time; + *(tcs->max_time_state_recomputed_in_seek) = time_span.end_time; return FALSE; } - +#ifdef BABEL_CLEANUP guint lttv_state_current_cpu(LttvTracefileState *tfs) { return tfs->cpu; @@ -3937,10 +3971,9 @@ void lttv_state_save_add_event_hooks(LttvTracesetState *self) } } #endif //0 -#ifdef BABEL_CLEANUP -void lttv_state_save_add_event_hooks(LttvTracesetState *self) + +void lttv_state_save_add_event_hooks(LttvTraceset *traceset) { - LttvTraceset *traceset = self->parent.ts; guint i, j, nb_trace, nb_tracefile; @@ -3948,7 +3981,17 @@ void lttv_state_save_add_event_hooks(LttvTracesetState *self) LttvTracefileState *tfs; - + + if(!traceset->has_precomputed_states) { + guint *event_count = g_new(guint, 1); + + *event_count = 0; + lttv_hooks_add(traceset->event_hooks, + state_save_event_hook, + event_count, + LTTV_PRIO_STATE); + +#ifdef BABEL_CLEANUP nb_trace = lttv_traceset_number(traceset); for(i = 0 ; i < nb_trace ; i++) { @@ -3971,21 +4014,22 @@ void lttv_state_save_add_event_hooks(LttvTracesetState *self) } } - - lttv_process_traceset_begin(&self->parent, - NULL, NULL, NULL, NULL, NULL); +#endif + lttv_process_traceset_begin(traceset, + NULL, NULL, NULL, NULL, NULL); + } } gint lttv_state_save_hook_add_event_hooks(void *hook_data, void *call_data) { - LttvTracesetState *tss = (LttvTracesetState*)(call_data); + LttvTraceset *ts = (LttvTraceset*)(call_data); - lttv_state_save_add_event_hooks(tss); + lttv_state_save_add_event_hooks(ts); return 0; } -#endif + #if 0 void lttv_state_save_remove_event_hooks(LttvTracesetState *self) @@ -4024,10 +4068,9 @@ void lttv_state_save_remove_event_hooks(LttvTracesetState *self) } } #endif //0 -#ifdef BABEL_CLEANUP -void lttv_state_save_remove_event_hooks(LttvTracesetState *self) + +void lttv_state_save_remove_event_hooks(LttvTraceset *traceset) { - LttvTraceset *traceset = self->parent.ts; guint i, j, nb_trace, nb_tracefile; @@ -4036,6 +4079,7 @@ void lttv_state_save_remove_event_hooks(LttvTracesetState *self) LttvTracefileState *tfs; LttvHooks *after_trace = lttv_hooks_new(); + guint *event_count = NULL; lttv_hooks_add(after_trace, state_save_after_trace_hook, @@ -4043,12 +4087,19 @@ void lttv_state_save_remove_event_hooks(LttvTracesetState *self) LTTV_PRIO_STATE); - lttv_process_traceset_end(&self->parent, - NULL, after_trace, NULL, NULL, NULL); + lttv_process_traceset_end(traceset, + NULL, after_trace, NULL, NULL); lttv_hooks_destroy(after_trace); - nb_trace = lttv_traceset_number(traceset); + //nb_trace = lttv_traceset_number(traceset); + + event_count = lttv_hooks_remove(traceset->event_hooks, + state_save_event_hook); + + if(event_count) g_free(event_count); + +#ifdef BABEL_CLEANUP for(i = 0 ; i < nb_trace ; i++) { ts = (LttvTraceState *)self->parent.traces[i]; @@ -4067,28 +4118,48 @@ void lttv_state_save_remove_event_hooks(LttvTracesetState *self) } if(event_count) g_free(event_count); } +#endif } gint lttv_state_save_hook_remove_event_hooks(void *hook_data, void *call_data) { - LttvTracesetState *tss = (LttvTracesetState*)(call_data); + LttvTraceset *ts = (LttvTraceset*)(call_data); - lttv_state_save_remove_event_hooks(tss); + lttv_state_save_remove_event_hooks(ts); return 0; } -void lttv_state_traceset_seek_time_closest(LttvTracesetState *self, LttTime t) + +void lttv_state_traceset_seek_time(LttvTraceset *traceset, LttTime t) { - LttvTraceset *traceset = self->parent.ts; + lttv_state_traceset_seek_time_closest(traceset, + t); + lttv_process_traceset_middle(traceset, t, G_MAXUINT, + NULL); +} +void lttv_state_traceset_seek_position(LttvTraceset *traceset, LttvTracesetPosition *position) +{ + LttTime t = lttv_traceset_position_get_time(position); + + lttv_state_traceset_seek_time_closest(traceset, + t); + lttv_process_traceset_middle(traceset, + ltt_time_infinite, + G_MAXUINT, + position); +} + +void lttv_state_traceset_seek_time_closest(LttvTraceset *traceset, LttTime t) +{ guint i, nb_trace; int min_pos, mid_pos, max_pos; guint call_rest = 0; - - LttvTraceState *tcs; + guint resto_start = 0; + guint resto_at = 0; LttvAttributeValue value; @@ -4099,6 +4170,8 @@ void lttv_state_traceset_seek_time_closest(LttvTracesetState *self, LttTime t) gboolean is_named; LttvAttribute *saved_states_tree, *saved_state_tree, *closest_tree = NULL; + + LttTime closest_tree_time, restored_time; //g_tree_destroy(self->parent.pqueue); //self->parent.pqueue = g_tree_new(compare_tracefile); @@ -4107,10 +4180,12 @@ void lttv_state_traceset_seek_time_closest(LttvTracesetState *self, LttTime t) nb_trace = lttv_traceset_number(traceset); for(i = 0 ; i < nb_trace ; i++) { - tcs = (LttvTraceState *)self->parent.traces[i]; - if(ltt_time_compare(t, *(tcs->max_time_state_recomputed_in_seek)) < 0) { - saved_states_tree = lttv_attribute_find_subdir(tcs->parent.t_a, + LttvTrace *trace = lttv_traceset_get(traceset, i); + LttvTraceState *tstate = trace->state; + + if(ltt_time_compare(t, *(tstate->max_time_state_recomputed_in_seek)) < 0) { + saved_states_tree = lttv_attribute_find_subdir(trace->a, LTTV_STATE_SAVED_STATES); min_pos = -1; @@ -4128,6 +4203,7 @@ void lttv_state_traceset_seek_time_closest(LttvTracesetState *self, LttTime t) if(ltt_time_compare(*(value.v_time), t) < 0) { min_pos = mid_pos; closest_tree = saved_state_tree; + closest_tree_time = *(value.v_time); } else max_pos = mid_pos - 1; @@ -4137,25 +4213,64 @@ void lttv_state_traceset_seek_time_closest(LttvTracesetState *self, LttTime t) /* restore the closest earlier saved state */ if(min_pos != -1) { - lttv_state_restore(tcs, closest_tree); - call_rest = 1; + if(ltt_time_compare(restored_time, closest_tree_time) == 0) { + + lttv_state_restore(tstate, closest_tree); + + restored_time = closest_tree_time; + call_rest = 1; + } else { + g_debug("State: restored time mismatch between traces"); + resto_start = 1; + break; + } + } /* 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); + resto_start = 1; + break; } } /* We want to seek quickly without restoring/updating the state */ else { - restore_init_state(tcs); - lttv_process_trace_seek_time(&(tcs->parent), t); + resto_at = 1; + break; } } - if(!call_rest) g_info("NOT Calling restore"); + + if(resto_start || resto_at) { + // Restore init state and seek so + for(i = 0 ; i < nb_trace ; i++) { + + LttvTrace *trace = lttv_traceset_get(traceset, i); + LttvTraceState *tstate = trace->state; + + restore_init_state(tstate); + } + + // If t > max saved state + if(resto_at) { + lttv_process_traceset_seek_time(traceset, t); + } else if (resto_start) { + // If no saved state + lttv_process_traceset_seek_time(traceset, ltt_time_zero); + } else { + g_assert(FALSE); + } + g_info("NOT Calling restore"); + + } else { + // Seek at checkpoint + lttv_process_traceset_seek_time(traceset, restored_time); + + + } + + } -#endif + #ifdef BABEL_CLEANUP static void traceset_state_instance_init (GTypeInstance *instance, gpointer g_class) { diff --git a/lttv/lttv/state.h b/lttv/lttv/state.h index cd91354c..109ee646 100644 --- a/lttv/lttv/state.h +++ b/lttv/lttv/state.h @@ -171,11 +171,22 @@ typedef struct _LttvTraceStateClass LttvTraceStateClass; typedef struct _LttvTracefileState LttvTracefileState; typedef struct _LttvTracefileStateClass LttvTracefileStateClass; -void lttv_traceset_add_state_event_hooks(LttvTraceset *traceset); +void lttv_state_add_event_hooks(LttvTraceset *traceset); +gint lttv_state_hook_add_event_hooks(void *hook_data, void *call_data); -void lttv_traceset_remove_state_event_hooks(LttvTraceset *traceset); +void lttv_state_remove_event_hooks(LttvTraceset *traceset); +gint lttv_state_hook_remove_event_hooks(void *hook_data, void *call_data); -void lttv_traceset_seek_time_closest_prior_state(LttvTraceset *traceset, LttTime t); +gint lttv_state_save_hook_add_event_hooks(void *hook_data, void *call_data); +gint lttv_state_save_hook_remove_event_hooks(void *hook_data, void *call_data); + + +//TODO ybrosseau 2012-07-30: Change name of seek_time_closest to: +//void lttv_traceset_seek_time_closest_prior_state(LttvTraceset *traceset, LttTime t); + +void lttv_state_traceset_seek_time_closest(LttvTraceset *traceset, LttTime t); +void lttv_state_traceset_seek_time(LttvTraceset *traceset, LttTime t); +void lttv_state_traceset_seek_position(LttvTraceset *traceset, LttvTracesetPosition *position); /* The LttvProcessState structure defines the current state for each process. A process can make system calls (in some rare cases nested) and receive @@ -364,7 +375,7 @@ struct _LttvTraceState { /* Array of per cpu running process */ LttvProcessState **running_process; - gboolean has_precomputed_states; + LttvCPUState *cpu_states; /* state of each cpu */ /* FIXME should be a g_array to deal with resize and copy. */ LttvIRQState *irq_states; /* state of each irq handler */ diff --git a/lttv/lttv/traceset-process.c b/lttv/lttv/traceset-process.c index edb7463b..54a68c07 100644 --- a/lttv/lttv/traceset-process.c +++ b/lttv/lttv/traceset-process.c @@ -259,7 +259,7 @@ guint lttv_process_traceset_seek_n_backward(LttvTraceset *ts, currentPos = lttv_traceset_create_time_position(ts,ltt_time_from_uint64(previousTimeStamp)); /*move traceset position */ - lttv_traceset_seek_to_position(previousPos); + lttv_state_traceset_seek_position(ts, previousPos); /* iterate to the initial position counting the number of event*/ count = 0; do { @@ -276,7 +276,7 @@ guint lttv_process_traceset_seek_n_backward(LttvTraceset *ts, if(extraEvent >= 0){ //if the extraEvent is over 0 go back to previousPos and //move forward the value of extraEvent times - lttv_traceset_seek_to_position(previousPos); + lttv_state_traceset_seek_position(ts, previousPos); for(i = 0 ; i < extraEvent ; i++){ if(bt_iter_next(bt_ctf_get_iter(ts->iter)) < 0){ diff --git a/lttv/lttv/traceset.c b/lttv/lttv/traceset.c index 12e8547b..934d65f3 100644 --- a/lttv/lttv/traceset.c +++ b/lttv/lttv/traceset.c @@ -68,6 +68,7 @@ LttvTraceset *lttv_traceset_new(void) ts->event_hooks = lttv_hooks_new(); ts->state_trace_handle_index = g_ptr_array_new(); + ts->has_precomputed_states = FALSE; return ts; } diff --git a/lttv/lttv/traceset.h b/lttv/lttv/traceset.h index 23d8a993..a5923c5d 100644 --- a/lttv/lttv/traceset.h +++ b/lttv/lttv/traceset.h @@ -43,6 +43,7 @@ struct _LttvTraceset { LttvHooks *event_hooks; struct bt_ctf_iter *iter; GPtrArray *state_trace_handle_index; + gboolean has_precomputed_states; }; struct _LttvTrace { diff --git a/lttv/modules/gui/detailedevents/events.c b/lttv/modules/gui/detailedevents/events.c index 7d034f0d..8d18ced3 100644 --- a/lttv/modules/gui/detailedevents/events.c +++ b/lttv/modules/gui/detailedevents/events.c @@ -1375,9 +1375,12 @@ static void get_events(double new_value, EventViewerData *event_viewer_data) pos = (LttvTracesetPosition*)g_ptr_array_index( event_viewer_data->pos, 0); - lttv_traceset_seek_to_position(pos); + lttv_state_traceset_seek_position(ts,pos); } - } + } else { + lttv_state_traceset_seek_time(ts,time); + + } /* Note that, as we mess with the tsc position, this function CANNOT be called * from a hook inside the lttv_process_traceset_middle. */ @@ -1426,11 +1429,11 @@ static void get_events(double new_value, EventViewerData *event_viewer_data) LttTime time_val = ltt_time_sub(time,time_span.start_time); event_viewer_data->previous_value = ltt_time_to_double(time_val); - lttv_traceset_seek_to_position(event_viewer_data->first_event); + lttv_state_traceset_seek_position(ts, event_viewer_data->first_event); } else { /* Seek by time */ - lttv_traceset_seek_to_position(timePos); + lttv_state_traceset_seek_time(ts, time); LttTime time_val = ltt_time_sub(time,time_span.start_time); @@ -1663,7 +1666,7 @@ gboolean update_current_time(void * hook_data, void * call_data) LttvTracesetPosition *currentPosition = lttv_traceset_create_time_position(ts,*current_time ); /*seek to current position*/ - lttv_traceset_seek_to_position(currentPosition); + lttv_state_traceset_seek_time(ts, *current_time); event_viewer_data->currently_selected_position = lttv_traceset_create_current_position(ts); diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c b/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c index 123cb7a2..bdb90e70 100644 --- a/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -38,6 +38,7 @@ #include #include #include +#include #ifdef BABEL_CLEANUP #include #include @@ -315,6 +316,44 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset) } lttv_state_add_event_hooks(traceset); + //TODO ybrosseau 2012-08-03 Temporarly compute checkpoints right at the adding + // of the traceset + //Compute the traceset state checkpoint + { + + EventsRequest *events_request = g_new(EventsRequest, 1); + + LttvHooks *hook_adder = lttv_hooks_new(); + lttv_hooks_add(hook_adder, lttv_state_save_hook_add_event_hooks, NULL, + LTTV_PRIO_DEFAULT); + LttvHooks *hook_remover = lttv_hooks_new(); + lttv_hooks_add(hook_remover, lttv_state_save_hook_remove_event_hooks, + NULL, LTTV_PRIO_DEFAULT); + + // Fill the events request + events_request->owner = NULL; + events_request->viewer_data = NULL; + events_request->servicing = FALSE; + events_request->start_time = ltt_time_zero; + events_request->start_position = NULL; + events_request->stop_flag = FALSE; + events_request->end_time = ltt_time_infinite; + events_request->num_events = G_MAXUINT; + events_request->end_position = NULL; + events_request->trace = 1; //fixed /* FIXME */ + events_request->before_chunk_traceset = NULL; + events_request->before_chunk_trace = NULL; + events_request->before_chunk_tracefile = NULL; + events_request->event = traceset->event_hooks; + events_request->after_chunk_tracefile = NULL; + events_request->after_chunk_trace = NULL; + events_request->after_chunk_traceset = NULL; + events_request->before_request = hook_adder; + events_request->after_request = hook_remover; + + lttvwindow_events_request(tab, events_request); + } + /* Finally, call the update hooks of the viewers */ gint retval = update_traceset(tab, traceset); @@ -937,8 +976,7 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) /* - Seek to that time */ g_debug("SEEK TIME : %lu, %lu", events_request->start_time.tv_sec, events_request->start_time.tv_nsec); - //lttv_process_traceset_seek_time(tsc, events_request->start_time); - lttv_process_traceset_seek_time(ts, + lttv_state_traceset_seek_time_closest(ts, events_request->start_time); /* Process the traceset with only state hooks */ @@ -954,7 +992,7 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) } else { - //LttTime pos_time; + LttTime pos_time; //LttvTracefileContext *tfc = // lttv_traceset_context_get_current_tfc(tsc); /* Else, the first request in list_in is a position request */ @@ -982,12 +1020,12 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) /* 1.2.2.1 Seek to that position */ g_debug("SEEK POSITION"); //lttv_process_traceset_seek_position(tsc, events_request->start_position); - //pos_time = lttv_traceset_position_get_time( - // events_request->start_position); - // - //lttv_state_traceset_seek_time(ts, - // pos_time); - lttv_traceset_seek_to_position( events_request->start_position); + pos_time = lttv_traceset_position_get_time( + events_request->start_position); + + lttv_state_traceset_seek_time_closest(ts, + pos_time); + //lttv_traceset_seek_to_position( events_request->start_position); /* Process the traceset with only state hooks */ #ifdef DEBUG @@ -1269,9 +1307,8 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) /* 5. After process traceset middle */ LttTime curTime = lttv_traceset_get_current_time(ts); - /* - if current context time > traceset.end time */ - if(ltt_time_compare(curTime, - lttv_traceset_get_time_span_real(ts).end_time) > 0) { + /* - if the iterator is not valid anymore (got to the end) */ + if(bt_ctf_iter_read_event(ts->iter) == NULL) { /* - For each req in list_in */ GSList *iter = list_in; @@ -3388,9 +3425,9 @@ void current_position_change_manager(Tab *tab, LttvTracesetPosition *pos) LttTime new_time = lttv_traceset_position_get_time(pos); /* Put the context in a state coherent position */ -#ifdef BABEL_CLEANUP - lttv_state_traceset_seek_time_closest((LttvTracesetState*)tsc, ltt_time_zero); -#endif /* BABEL_CLEANUP */ + + lttv_state_traceset_seek_time_closest(tab->traceset_info->traceset, ltt_time_zero); + current_time_change_manager(tab, new_time); set_current_position(tab, pos);