X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmodules%2Fgui%2Flttvwindow%2Flttvwindow%2Fcallbacks.c;h=481b939f3e14062ee40f738833ea7735c55cf723;hb=6c35c85397452fe2f5d3de0badb67ee7df0ee37e;hp=d30a490da2399f450e6b683dd00f1ff957011a30;hpb=53ac91316921e188b4e778a7b766016d4a6dd2a2;p=lttv.git diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c index d30a490d..481b939f 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -49,7 +49,7 @@ #include -#define DEFAULT_TIME_WIDTH_S 1 +static LttTime lttvwindow_default_time_width = { 1, 0 }; #define CLIP_BUF 256 // size of clipboard buffer extern LttvTrace *g_init_trace ; @@ -331,6 +331,18 @@ static void connect_focus_recursive(GtkWidget *widget, (gpointer)viewer); } +/* Stop all the processings and call gtk_main_quit() */ +static void mainwindow_quit() +{ + lttvwindowtraces_unregister_requests(g_quark_from_string("stats")); + lttvwindowtraces_unregister_requests(g_quark_from_string("state")); + lttvwindowtraces_unregister_computation_hooks(g_quark_from_string("stats")); + lttvwindowtraces_unregister_computation_hooks(g_quark_from_string("state")); + + gtk_main_quit(); +} + + /* insert_viewer function constructs an instance of a viewer first, * then inserts the widget of the instance into the container of the * main window @@ -409,12 +421,13 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset) new_current_time = time_span.start_time; LttTime tmp_time; - - if(DEFAULT_TIME_WIDTH_S < time_span.end_time.tv_sec) - tmp_time.tv_sec = DEFAULT_TIME_WIDTH_S; + + if(ltt_time_compare(lttvwindow_default_time_width, + ltt_time_sub(time_span.end_time, time_span.start_time)) < 0) + tmp_time = lttvwindow_default_time_width; else - tmp_time.tv_sec = time_span.end_time.tv_sec; - tmp_time.tv_nsec = 0; + tmp_time = time_span.end_time; + new_time_window.time_width = tmp_time ; new_time_window.time_width_double = ltt_time_to_double(tmp_time); new_time_window.end_time = ltt_time_add(new_time_window.start_time, @@ -424,7 +437,7 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset) current_time_change_manager(tab, new_current_time); //FIXME : we delete the filter tree, when it should be updated. - lttv_filter_tree_destroy(tab->filter); + lttv_filter_destroy(tab->filter); tab->filter = NULL; #if 0 @@ -502,7 +515,7 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset) * 0 : filters updated * 1 : no filter hooks to update; not an error. */ - +#if 0 int SetFilter(Tab * tab, gpointer filter) { LttvHooks * tmp; @@ -518,7 +531,7 @@ int SetFilter(Tab * tab, gpointer filter) return 0; } - +#endif //0 /** @@ -809,42 +822,6 @@ void open_traceset(GtkWidget * widget, gpointer user_data) } -static void events_request_free(EventsRequest *events_request) -{ - if(events_request == NULL) return; - - if(events_request->start_position != NULL) - lttv_traceset_context_position_destroy(events_request->start_position); - if(events_request->end_position != NULL) - lttv_traceset_context_position_destroy(events_request->end_position); - if(events_request->hooks != NULL) - g_array_free(events_request->hooks, TRUE); - if(events_request->before_chunk_traceset != NULL) - lttv_hooks_destroy(events_request->before_chunk_traceset); - if(events_request->before_chunk_trace != NULL) - lttv_hooks_destroy(events_request->before_chunk_trace); - if(events_request->before_chunk_tracefile != NULL) - lttv_hooks_destroy(events_request->before_chunk_tracefile); - if(events_request->event != NULL) - lttv_hooks_destroy(events_request->event); - if(events_request->event_by_id != NULL) - lttv_hooks_by_id_destroy(events_request->event_by_id); - if(events_request->after_chunk_tracefile != NULL) - lttv_hooks_destroy(events_request->after_chunk_tracefile); - if(events_request->after_chunk_trace != NULL) - lttv_hooks_destroy(events_request->after_chunk_trace); - if(events_request->after_chunk_traceset != NULL) - lttv_hooks_destroy(events_request->after_chunk_traceset); - if(events_request->before_request != NULL) - lttv_hooks_destroy(events_request->before_request); - if(events_request->after_request != NULL) - lttv_hooks_destroy(events_request->after_request); - - g_free(events_request); -} - - - /* lttvwindow_process_pending_requests * * This internal function gets called by g_idle, taking care of the pending @@ -957,8 +934,9 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) } /* 0.2 Seek tracefiles positions to context position */ + //g_assert(lttv_process_traceset_seek_position(tsc, sync_position) == 0); lttv_process_traceset_synchronize_tracefiles(tsc); - + /* Events processing algorithm implementation */ /* Warning : the gtk_events_pending takes a LOT of cpu time. So what we do @@ -1100,6 +1078,9 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) lttv_process_traceset_middle(tsc, events_request->start_time, G_MAXUINT, NULL); +#ifdef DEBUG + g_assert(seek_count < LTTV_STATE_SAVE_INTERVAL); +#endif //DEBUG } else { @@ -1564,7 +1545,7 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) /* 1.1. Use current postition as start position */ if(events_request->start_position != NULL) lttv_traceset_context_position_destroy(events_request->start_position); - events_request->start_position = lttv_traceset_context_position_new(); + events_request->start_position = lttv_traceset_context_position_new(tsc); lttv_traceset_context_position_save(tsc, events_request->start_position); /* 1.2. Remove start time */ @@ -1590,10 +1571,10 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) } - /* C Unlock Traces */ { - //lttv_process_traceset_get_sync_data(tsc); + lttv_process_traceset_get_sync_data(tsc); + //lttv_traceset_context_position_save(tsc, sync_position); guint iter_trace; @@ -1605,7 +1586,6 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) lttvwindowtraces_unlock(trace_v); } } - #if 0 //set the cursor back to normal gdk_window_set_cursor(win, NULL); @@ -2259,6 +2239,8 @@ Tab *create_new_tab(GtkWidget* widget, gpointer user_data){ strcpy(label,"Page"); if(get_label(mw_data, label,"Get the name of the tab","Please input tab's name")) return (create_tab (mw_data, copy_tab, notebook, label)); + else + return NULL; } void @@ -2362,7 +2344,7 @@ void on_quit_activate (GtkMenuItem *menuitem, gpointer user_data) { - gtk_main_quit (); + mainwindow_quit(); } @@ -3199,7 +3181,7 @@ on_MWindow_destroy (GtkWidget *widget, g_info("There are now : %d windows\n",g_slist_length(g_main_window_list)); if(g_slist_length(g_main_window_list) == 0) - gtk_main_quit (); + mainwindow_quit(); } gboolean @@ -3257,6 +3239,8 @@ void time_change_manager (Tab *tab, LttTime start_time = new_time_window.start_time; LttTime end_time = new_time_window.end_time; + g_assert(ltt_time_compare(start_time, end_time) < 0); + /* Set scrollbar */ GtkAdjustment *adjustment = gtk_range_get_adjustment(GTK_RANGE(tab->scrollbar)); LttTime upper = ltt_time_sub(time_span.end_time, time_span.start_time); @@ -3607,6 +3591,22 @@ void current_time_change_manager (Tab *tab, tab->current_time_manager_lock = FALSE; } +void current_position_change_manager(Tab *tab, + LttvTracesetContextPosition *pos) +{ + LttvTracesetContext *tsc = + LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); + TimeInterval time_span = tsc->time_span; + + g_assert(lttv_process_traceset_seek_position(tsc, pos) == 0); + LttTime new_time = lttv_traceset_context_position_get_time(pos); + + current_time_change_manager(tab, new_time); + + set_current_position(tab, pos); +} + + void on_MEntry5_value_changed (GtkSpinButton *spinbutton, gpointer user_data) @@ -3809,7 +3809,7 @@ char * get_selection(char ** loaded_module_name, int nb_module, } id = gtk_dialog_run(GTK_DIALOG(dialogue)); - GtkTreeModel **store_model = (GtkTreeModel**)&store; /* for strict aliasing */ + GtkTreeModel **store_model = (GtkTreeModel**)&store; switch(id){ case GTK_RESPONSE_ACCEPT: case GTK_RESPONSE_OK: @@ -4122,14 +4122,17 @@ Tab* create_tab(MainWindow * mw, Tab *copy_tab, /* Copy the previous tab's filter */ /* We can clone the filter, as we copy the trace set also */ /* The filter must always be in sync with the trace set */ - if(copy_tab->filter != NULL) - tab->filter = lttv_filter_clone(copy_tab->filter); - else - tab->filter = NULL; - + tab->filter = lttv_filter_clone(copy_tab->filter); + tab->time_window = copy_tab->time_window; + tab->current_time = copy_tab->current_time; } else { tab->traceset_info->traceset = lttv_traceset_new(); tab->filter = NULL; + tab->time_window.start_time = ltt_time_zero; + tab->time_window.time_width = lttvwindow_default_time_width; + tab->time_window.end_time = ltt_time_add(tab->time_window.start_time, + tab->time_window.time_width); + tab->current_time = ltt_time_zero; } #ifdef DEBUG @@ -4188,7 +4191,7 @@ Tab* create_tab(MainWindow * mw, Tab *copy_tab, tab->viewer_container = gtk_vbox_new(TRUE, 2); tab->scrollbar = gtk_hscrollbar_new(NULL); //tab->multivpaned = gtk_multi_vpaned_new(); - + gtk_box_pack_start(GTK_BOX(tab->vbox), tab->viewer_container, TRUE, /* expand */