From fb3d60478f102a4c2bb0746effa6e2ab049747ba Mon Sep 17 00:00:00 2001 From: compudj Date: Wed, 11 Oct 2006 18:04:57 +0000 Subject: [PATCH] fix detailed event list behavior git-svn-id: http://ltt.polymtl.ca/svn@2194 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/configure.in | 2 +- ltt/branches/poly/lttv/lttv/batchtest.c | 42 +++++++------- ltt/branches/poly/lttv/lttv/tracecontext.c | 16 +++-- ltt/branches/poly/lttv/lttv/tracecontext.h | 8 ++- .../lttv/modules/gui/detailedevents/events.c | 58 ++++++++++++++----- .../lttv/modules/gui/detailedevents/events.h | 1 + .../gui/lttvwindow/lttvwindow/interface.c | 1 + 7 files changed, 86 insertions(+), 42 deletions(-) diff --git a/ltt/branches/poly/configure.in b/ltt/branches/poly/configure.in index 2cf664c6..3c797808 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.63-10102006) +AM_INIT_AUTOMAKE(LinuxTraceToolkitViewer,0.8.64-11102006) AM_CONFIG_HEADER(config.h) AM_PROG_LIBTOOL diff --git a/ltt/branches/poly/lttv/lttv/batchtest.c b/ltt/branches/poly/lttv/lttv/batchtest.c index 865a4cb9..7b26ac6b 100644 --- a/ltt/branches/poly/lttv/lttv/batchtest.c +++ b/ltt/branches/poly/lttv/lttv/batchtest.c @@ -661,18 +661,18 @@ static gboolean process_traceset(void __UNUSED__ *hook_data, g_message("Running test 9 : seek_forward and seek_backward"); lttv_process_traceset_seek_time(tsc, ltt_time_zero); - count = lttv_process_traceset_seek_n_forward(tsc, 500, NULL, NULL, NULL, NULL, NULL); + count = lttv_process_traceset_seek_n_forward(tsc, 500, NULL, NULL, NULL, NULL, NULL, NULL); g_assert(count == 500); lttv_traceset_context_position_save(tsc, saved_pos); t0 = get_time(); - count = lttv_process_traceset_seek_n_forward(tsc, 150000, NULL, NULL, NULL, NULL, NULL); + count = lttv_process_traceset_seek_n_forward(tsc, 150000, NULL, NULL, NULL, NULL, NULL, NULL); t1 = get_time(); g_message("Seek forward 150000 events in %g seconds", t1 - t0); g_assert(count == 150000); t0 = get_time(); count = lttv_process_traceset_seek_n_backward(tsc, 150000, seek_back_default_offset, lttv_process_traceset_seek_time, NULL, - NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); t1 = get_time(); g_message("Seek backward 150000 events in %g seconds", t1 - t0); g_assert(count == 150000); @@ -680,20 +680,20 @@ static gboolean process_traceset(void __UNUSED__ *hook_data, g_warning("Problem with seek_n ! Positions differ. (1)"); } - lttv_process_traceset_seek_n_forward(tsc, 500, NULL, NULL, NULL, NULL, NULL); + lttv_process_traceset_seek_n_forward(tsc, 500, NULL, NULL, NULL, NULL, NULL, NULL); lttv_traceset_context_position_save(tsc, saved_pos); - lttv_process_traceset_seek_n_forward(tsc, 15000, NULL, NULL, NULL, NULL, NULL); + lttv_process_traceset_seek_n_forward(tsc, 15000, NULL, NULL, NULL, NULL, NULL, NULL); lttv_process_traceset_seek_n_backward(tsc, 15005, seek_back_default_offset, lttv_process_traceset_seek_time, NULL, - NULL, NULL, NULL, NULL); - lttv_process_traceset_seek_n_forward(tsc, 5, NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); + lttv_process_traceset_seek_n_forward(tsc, 5, NULL, NULL, NULL, NULL, NULL, NULL); if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos)) { g_warning("Problem with seek_n ! Positions differ. (2)"); } lttv_process_traceset_seek_time(tsc, ltt_time_infinite); - count = lttv_process_traceset_seek_n_forward(tsc, 15000, NULL, NULL, NULL, NULL, NULL); + count = lttv_process_traceset_seek_n_forward(tsc, 15000, NULL, NULL, NULL, NULL, NULL, NULL); if(count > 0) g_warning("Problem with seek_n ! Forward at end of traceset."); @@ -703,11 +703,11 @@ static gboolean process_traceset(void __UNUSED__ *hook_data, t0 = get_time(); lttv_process_traceset_seek_n_backward(tsc, 300, seek_back_default_offset, lttv_process_traceset_seek_time, NULL, - NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); t1 = get_time(); g_message("Seek backward 300 events in %g seconds", t1 - t0); - count = lttv_process_traceset_seek_n_forward(tsc, 299, NULL, NULL, NULL, NULL, NULL); - count = lttv_process_traceset_seek_n_forward(tsc, 1, NULL, NULL, NULL, NULL, NULL); + count = lttv_process_traceset_seek_n_forward(tsc, 299, NULL, NULL, NULL, NULL, NULL, NULL); + count = lttv_process_traceset_seek_n_forward(tsc, 1, NULL, NULL, NULL, NULL, NULL, NULL); if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos)) { g_warning("Problem with seek_n ! Positions differ. (4)"); @@ -717,11 +717,11 @@ static gboolean process_traceset(void __UNUSED__ *hook_data, t0 = get_time(); lttv_process_traceset_seek_n_backward(tsc, 10, seek_back_default_offset, lttv_process_traceset_seek_time, NULL, - NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); t1 = get_time(); g_message("Seek backward 10 events in %g seconds", t1 - t0); t0 = get_time(); - count = lttv_process_traceset_seek_n_forward(tsc, 10, NULL, NULL, NULL, NULL, NULL); + count = lttv_process_traceset_seek_n_forward(tsc, 10, NULL, NULL, NULL, NULL, NULL, NULL); t1 = get_time(); g_message("Seek forward 10 events in %g seconds", t1 - t0); @@ -732,9 +732,9 @@ static gboolean process_traceset(void __UNUSED__ *hook_data, lttv_traceset_context_position_save(tsc, saved_pos); lttv_process_traceset_seek_n_backward(tsc, 301, seek_back_default_offset, lttv_process_traceset_seek_time, NULL, - NULL, NULL, NULL, NULL); - count = lttv_process_traceset_seek_n_forward(tsc, 299, NULL, NULL, NULL, NULL, NULL); - count = lttv_process_traceset_seek_n_forward(tsc, 1, NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); + count = lttv_process_traceset_seek_n_forward(tsc, 299, NULL, NULL, NULL, NULL, NULL, NULL); + count = lttv_process_traceset_seek_n_forward(tsc, 1, NULL, NULL, NULL, NULL, NULL, NULL); if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos) == 0) { g_warning("Problem with seek_n ! Positions _should_ differ. (5)"); @@ -743,17 +743,17 @@ static gboolean process_traceset(void __UNUSED__ *hook_data, /* Try a seek by closest time : Hint : try this one with and without states * computed. */ lttv_process_traceset_seek_time(tsc, ltt_time_zero); - count = lttv_process_traceset_seek_n_forward(tsc, 200000, NULL, NULL, NULL, NULL, NULL); + count = lttv_process_traceset_seek_n_forward(tsc, 200000, NULL, NULL, NULL, NULL, NULL, NULL); lttv_traceset_context_position_save(tsc, saved_pos); t0 = get_time(); lttv_process_traceset_seek_n_backward(tsc, 100301, seek_back_default_offset, (seek_time_fct)lttv_state_traceset_seek_time_closest, NULL, - NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); t1 = get_time(); g_message("Seek backward 100301 events (with seek closest) in %g seconds", t1 - t0); - count = lttv_process_traceset_seek_n_forward(tsc, 100301, NULL, NULL, NULL, NULL, NULL); + count = lttv_process_traceset_seek_n_forward(tsc, 100301, NULL, NULL, NULL, NULL, NULL, NULL); if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos)) { g_warning("Problem with seek_n with state seek time! Positions differ. (6)"); @@ -769,7 +769,7 @@ static gboolean process_traceset(void __UNUSED__ *hook_data, lttv_traceset_context_position_new(tsc); lttv_process_traceset_seek_time(tsc, ltt_time_zero); - lttv_process_traceset_seek_n_forward(tsc, 200000, NULL, NULL, NULL, NULL, NULL); + lttv_process_traceset_seek_n_forward(tsc, 200000, NULL, NULL, NULL, NULL, NULL, NULL); lttv_traceset_context_position_save(tsc, saved_pos); if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos) != 0) g_critical("Error in seek position. (1)"); @@ -777,7 +777,7 @@ static gboolean process_traceset(void __UNUSED__ *hook_data, lttv_process_traceset_seek_time(tsc, ltt_time_infinite); lttv_process_traceset_seek_n_backward(tsc, 500, seek_back_default_offset, lttv_process_traceset_seek_time, NULL, - NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); lttv_traceset_context_position_save(tsc, saved_pos); if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos) != 0) diff --git a/ltt/branches/poly/lttv/lttv/tracecontext.c b/ltt/branches/poly/lttv/lttv/tracecontext.c index f98f812c..ca7f4ea4 100644 --- a/ltt/branches/poly/lttv/lttv/tracecontext.c +++ b/ltt/branches/poly/lttv/lttv/tracecontext.c @@ -1340,6 +1340,7 @@ struct seek_back_data { LttvFilter *filter1; LttvFilter *filter2; LttvFilter *filter3; + gpointer data; check_handler *check; gboolean *stop_flag; guint raw_event_count; @@ -1352,7 +1353,8 @@ static gint seek_back_event_hook(void *hook_data, void* call_data) LttvTracesetContext *tsc = tfc->t_context->ts_context; LttvTracesetContextPosition *pos; - if(sd->check && sd->check(sd->raw_event_count, sd->stop_flag)) return TRUE; + if(sd->check && sd->check(sd->raw_event_count, sd->stop_flag, sd->data)) + return TRUE; sd->raw_event_count++; if(sd->filter1 != NULL && sd->filter1->head != NULL && @@ -1426,7 +1428,8 @@ guint lttv_process_traceset_seek_n_backward(LttvTracesetContext *self, gboolean *stop_flag, LttvFilter *filter1, LttvFilter *filter2, - LttvFilter *filter3) + LttvFilter *filter3, + gpointer data) { if(lttv_traceset_number(self->ts) == 0) return 0; g_assert(ltt_time_compare(first_offset, ltt_time_zero) != 0); @@ -1450,6 +1453,7 @@ guint lttv_process_traceset_seek_n_backward(LttvTracesetContext *self, sd.filter1 = filter1; sd.filter2 = filter2; sd.filter3 = filter3; + sd.data = data; sd.n = n; sd.check = check; sd.stop_flag = stop_flag; @@ -1562,6 +1566,7 @@ struct seek_forward_data { LttvFilter *filter1; LttvFilter *filter2; LttvFilter *filter3; + gpointer data; check_handler *check; gboolean *stop_flag; guint raw_event_count; /* event counter */ @@ -1572,7 +1577,8 @@ static gint seek_forward_event_hook(void *hook_data, void* call_data) struct seek_forward_data *sd = (struct seek_forward_data*)hook_data; LttvTracefileContext *tfc = (LttvTracefileContext*)call_data; - if(sd->check && sd->check(sd->raw_event_count, sd->stop_flag)) return TRUE; + if(sd->check && sd->check(sd->raw_event_count, sd->stop_flag, sd->data)) + return TRUE; sd->raw_event_count++; if(sd->filter1 != NULL && sd->filter1->head != NULL && @@ -1621,7 +1627,8 @@ guint lttv_process_traceset_seek_n_forward(LttvTracesetContext *self, gboolean *stop_flag, LttvFilter *filter1, LttvFilter *filter2, - LttvFilter *filter3) + LttvFilter *filter3, + gpointer data) { struct seek_forward_data sd; sd.event_count = 0; @@ -1629,6 +1636,7 @@ guint lttv_process_traceset_seek_n_forward(LttvTracesetContext *self, sd.filter1 = filter1; sd.filter2 = filter2; sd.filter3 = filter3; + sd.data = data; sd.check = check; sd.stop_flag = stop_flag; sd.raw_event_count = 0; diff --git a/ltt/branches/poly/lttv/lttv/tracecontext.h b/ltt/branches/poly/lttv/lttv/tracecontext.h index 70993e7a..1336160b 100644 --- a/ltt/branches/poly/lttv/lttv/tracecontext.h +++ b/ltt/branches/poly/lttv/lttv/tracecontext.h @@ -352,7 +352,7 @@ void lttv_process_traceset_get_sync_data(LttvTracesetContext *tsc); static const LttTime seek_back_default_offset = { 1, 0 }; -typedef gboolean check_handler(guint count, gboolean *stop_flag); +typedef gboolean check_handler(guint count, gboolean *stop_flag, gpointer data); guint lttv_process_traceset_seek_n_forward(LttvTracesetContext *self, guint n, @@ -360,7 +360,8 @@ guint lttv_process_traceset_seek_n_forward(LttvTracesetContext *self, gboolean *stop_flag, LttvFilter *filter1, LttvFilter *filter2, - LttvFilter *filter3); + LttvFilter *filter3, + gpointer data); typedef void (*seek_time_fct)(LttvTracesetContext *self, LttTime start); /* If first_offset is ltt_time_zero, it will choose a default value */ @@ -372,7 +373,8 @@ guint lttv_process_traceset_seek_n_backward(LttvTracesetContext *self, gboolean *stop_flag, LttvFilter *filter1, LttvFilter *filter2, - LttvFilter *filter3); + LttvFilter *filter3, + gpointer data); #endif // PROCESSTRACE_H diff --git a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c index 2e123ad6..5350ab45 100644 --- a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c +++ b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c @@ -237,6 +237,8 @@ gui_events(LttvPluginTab *ptab) event_viewer_data->last_tree_update_time = 0; + event_viewer_data->init_done = 0; + /* Create a model for storing the data list */ event_viewer_data->store_m = gtk_list_store_new ( N_COLUMNS, /* Total number of columns */ @@ -460,6 +462,9 @@ gui_events(LttvPluginTab *ptab) event_viewer_data->previous_value = 0; event_viewer_data->vadjust_c->lower = 0.0; //event_viewer_data->vadjust_c->upper = event_viewer_data->number_of_events; + LttTime time = lttvwindow_get_current_time(tab); + time = ltt_time_sub(time, tsc->time_span.start_time); + event_viewer_data->vadjust_c->value = ltt_time_to_double(time); event_viewer_data->vadjust_c->value = 0.0; event_viewer_data->vadjust_c->step_increment = 1.0; event_viewer_data->vadjust_c->page_increment = 2.0; @@ -505,9 +510,9 @@ gui_events(LttvPluginTab *ptab) event_viewer_data->background_info_waiting = 0; + request_background_data(event_viewer_data); - return event_viewer_data; } @@ -1101,6 +1106,7 @@ static void tree_selection_changed_cb (GtkTreeSelection *selection, { g_debug("tree sel changed cb"); EventViewerData *event_viewer_data = (EventViewerData*) data; + #if 0 /* Set the cursor to currently selected event */ GtkTreeModel* model = GTK_TREE_MODEL(event_viewer_data->store_m); @@ -1229,14 +1235,15 @@ void tree_v_size_allocate_cb (GtkWidget *widget, GtkAllocation *alloc, gpointer floor(exact_num_visible); */ - g_debug("size allocate : last_num_visible_events : %d,\ - num_visible_events : %d", - last_num_visible_events, - event_viewer_data->num_visible_events); - if(event_viewer_data->num_visible_events != last_num_visible_events) - { + g_debug("size allocate %p : last_num_visible_events : %d", + event_viewer_data, last_num_visible_events); + g_debug("num_visible_events : %d, value %lu", + event_viewer_data->num_visible_events, + event_viewer_data->vadjust_c->value); + + if(event_viewer_data->num_visible_events != last_num_visible_events) { get_events(event_viewer_data->vadjust_c->value, event_viewer_data); - } + } } @@ -1280,10 +1287,23 @@ gboolean show_event_detail(void * hook_data, void * call_data) } #endif //0 -static gboolean events_check_handler(guint count, gboolean *stop_flag) +static gboolean events_check_handler(guint count, gboolean *stop_flag, + gpointer data) { + EventViewerData *evd = (EventViewerData*)data; if(count % CHECK_GDK_INTERVAL == 0) { - gtk_main_iteration_do(FALSE); + GdkEvent *event; + GtkWidget *widget; + while((event = gdk_event_get()) != NULL) { + widget = gtk_get_event_widget(event); + if(widget == + lookup_widget(main_window_get_widget(evd->tab), + "StopProcessingButton")) { + gtk_main_do_event(event); + gdk_window_process_all_updates(); + } + gdk_event_free(event); + } if(*stop_flag) return TRUE; else @@ -1410,7 +1430,7 @@ static void get_events(double new_value, EventViewerData *event_viewer_data) events_check_handler, &event_viewer_data->tab->stop_foreground, event_viewer_data->main_win_filter, - event_viewer_data->filter, NULL); + event_viewer_data->filter, NULL, event_viewer_data); } else if(relative_position < 0) { guint count; @@ -1430,7 +1450,7 @@ static void get_events(double new_value, EventViewerData *event_viewer_data) events_check_handler, &event_viewer_data->tab->stop_foreground, event_viewer_data->main_win_filter, - event_viewer_data->filter, NULL); + event_viewer_data->filter, NULL, event_viewer_data); } /* else 0 : do nothing : we are already at the beginning position */ lttv_traceset_context_position_destroy(pos); @@ -1525,7 +1545,19 @@ int event_hook(void *hook_data, void *call_data) LttEvent *e = ltt_tracefile_get_event(tfc->tf); if(event_viewer_data->num_events % CHECK_GDK_INTERVAL == 0) { - gtk_main_iteration_do(FALSE); + GdkEvent *event; + GtkWidget *widget; + while((event = gdk_event_get()) != NULL) { + widget = gtk_get_event_widget(event); + if(widget == + lookup_widget(main_window_get_widget(event_viewer_data->tab), + "StopProcessingButton")) { + gtk_main_do_event(event); + gdk_window_process_all_updates(); + } + gdk_event_free(event); + } + //gtk_main_iteration_do(FALSE); if(event_viewer_data->tab->stop_foreground) return TRUE; } diff --git a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.h b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.h index 43818c0d..93b0df2e 100644 --- a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.h +++ b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.h @@ -66,6 +66,7 @@ struct _EventViewerData { GtkWidget *toolbar; GtkToolItem *button_filter; + guint init_done; }; extern gint evd_redraw_notify(void *hook_data, void *call_data); diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/interface.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/interface.c index 55044a05..007b33e6 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/interface.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/interface.c @@ -529,6 +529,7 @@ create_MWindow (void) gtk_label_set_use_underline (GTK_LABEL (((GtkToolbarChild*) (g_list_last (GTK_TOOLBAR (MToolbar1)->children)->data))->label), TRUE); gtk_widget_show (tlbStopProcessing); gtk_container_set_border_width (GTK_CONTAINER (tlbStopProcessing), 1); + GLADE_HOOKUP_OBJECT (MWindow, tlbStopProcessing, "StopProcessingButton"); gtk_toolbar_append_space (GTK_TOOLBAR (MToolbar1)); -- 2.34.1