From: Francis Deslauriers Date: Thu, 7 Jun 2012 19:47:14 +0000 (-0400) Subject: initial port of the mainwindow X-Git-Tag: v1.5-beta1~69 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=451aaf275d421d71097d479eb0ae64fe908d8b6f;p=lttv.git initial port of the mainwindow Signed-off-by: Francis Deslauriers Signed-off-by: Yannick Brosseau --- diff --git a/configure.ac b/configure.ac index e1d04d05..2af9ebec 100644 --- a/configure.ac +++ b/configure.ac @@ -37,7 +37,7 @@ AC_ARG_WITH(lttv-gui, [with_lttv_gui="yes"]) #TODO ybrosseau 2012-03-13: Remove this when babeltrace port is complete #Force GUI disabling while we port babeltrace -with_lttv_gui="no" +#with_lttv_gui="no" AM_CONDITIONAL([BUILD_LTTV_GUI], [ test "x$with_lttv_gui" = "xyes" ]) diff --git a/ltt/time.h b/ltt/time.h index 14c15d1d..5a959d01 100644 --- a/ltt/time.h +++ b/ltt/time.h @@ -21,7 +21,7 @@ #define LTT_TIME_H #include -#include +#include #include typedef struct _LttTime { diff --git a/lttv/lttv/filter.h b/lttv/lttv/filter.h index 7b60ab40..4b51025b 100644 --- a/lttv/lttv/filter.h +++ b/lttv/lttv/filter.h @@ -350,17 +350,15 @@ gboolean lttv_filter_tree_parse( const LttEvent* event, const LttTracefile* tracefile, const LttTrace* trace, - const LttvTracefileContext* context, const LttvProcessState* pstate, - const LttvTraceContext* tc); + const LttvTrace* tracev); gboolean lttv_filter_tree_parse_branch( const LttvSimpleExpression* se, const LttEvent* event, const LttTracefile* tracefile, const LttTrace* trace, - const LttvProcessState* state, - const LttvTracefileContext* context); + const LttvProcessState* state); /* * Debug functions diff --git a/lttv/lttv/traceset.c b/lttv/lttv/traceset.c index b4a14384..97499b59 100644 --- a/lttv/lttv/traceset.c +++ b/lttv/lttv/traceset.c @@ -25,13 +25,19 @@ #include #include #include +#include #include -#include +#include #include /* To traverse a tree recursively */ #include #include +/* For the use of realpath*/ +#include +#include +/* For strcpy*/ +#include /* A trace is a sequence of events gathered in the same tracing session. The events may be stored in several tracefiles in the same directory. @@ -53,17 +59,12 @@ LttvTraceset *lttv_traceset_new(void) //TODO remove this when we have really mecanism //s->tmpState = g_new(LttvTraceState *, 1); //lttv_trace_state_init(s->tmpState,0); - begin_pos.type = BT_SEEK_BEGIN; - //s->iter = bt_ctf_iter_create(lttv_traceset_get_context(s), - // &begin_pos, - // NULL); s->iter = 0; s->event_hooks = lttv_hooks_new(); + s->state_trace_handle_index = g_ptr_array_new(); - - return s; } @@ -84,6 +85,30 @@ LttvTrace *lttv_trace_new(LttTrace *t) return new_trace; } #endif +/* + * get_absolute_pathname : Return the unique pathname in the system + * + * pathname is the relative path. + * + * abs_pathname is being set to the absolute path. + * + */ +void get_absolute_pathname(const gchar *pathname, gchar * abs_pathname) +{ + abs_pathname[0] = '\0'; + + if (realpath(pathname, abs_pathname) != NULL) + return; + else + { + /* error, return the original path unmodified */ + strcpy(abs_pathname, pathname); + return; + } + return; +} + + /* * lttv_trace_create : Create a trace from a path @@ -239,7 +264,6 @@ void lttv_trace_destroy(LttvTrace *t) g_free(t); } - void lttv_traceset_add(LttvTraceset *s, LttvTrace *t) { t->ref_count++; @@ -248,11 +272,14 @@ void lttv_traceset_add(LttvTraceset *s, LttvTrace *t) int lttv_traceset_add_path(LttvTraceset *ts, char *trace_path) { + FTS *tree; FTSENT *node; char * const paths[2] = { trace_path, NULL }; int ret = -1; + ts->filename = trace_path; + tree = fts_open(paths, FTS_NOCHDIR | FTS_LOGICAL, 0); if (tree == NULL) { g_warning("Cannot traverse \"%s\" for reading.\n", @@ -353,12 +380,6 @@ LttvAttribute *lttv_trace_attribute(LttvTrace *t) return t->a; } -#ifdef BABEL_CLEANUP -LttTrace *lttv_trace(LttvTrace *t) -{ - return t->t; -} -#endif gint lttv_trace_get_id(LttvTrace *t) { @@ -442,6 +463,68 @@ guint lttv_traceset_get_cpuid_from_event(LttvEvent *event) return cpu_id; } } +/* + * lttv_traceset_get_timestamp_begin : returns the minimum timestamp of + * all the traces in the traceset. + * + */ + +guint64 lttv_traceset_get_timestamp_begin(LttvTraceset *traceset) +{ + struct bt_context *bt_ctx; + bt_ctx = lttv_traceset_get_context(traceset); + guint64 timestamp_min = G_MAXUINT64, timestamp_cur = 0; + int i; + int trace_count; + LttvTrace *currentTrace; + trace_count = traceset->traces->len; + if(trace_count == 0) + timestamp_min = 0; + else{ + timestamp_min = G_MAXUINT64; + + for(i = 0; i < trace_count;i++) + { + currentTrace = g_ptr_array_index(traceset->traces,i); + timestamp_cur = bt_trace_handle_get_timestamp_begin(bt_ctx, currentTrace->id); + if(timestamp_cur < timestamp_min) + timestamp_min = timestamp_cur; + } + } + return timestamp_min; +} + +/* + * lttv_traceset_get_timestamp_end: returns the maximum timestamp of + * all the traces in the traceset. + * + */ +guint64 lttv_traceset_get_timestamp_end(LttvTraceset *traceset) +{ + struct bt_context *bt_ctx; + bt_ctx = lttv_traceset_get_context(traceset); + guint64 timestamp_max, timestamp_cur = 0; + int i; + int trace_count; + LttvTrace *currentTrace; + trace_count = traceset->traces->len; + + if(trace_count == 0) + timestamp_max = 1; + else + { + timestamp_max = 0; + for(i =0; i < trace_count;i++) + { + currentTrace = g_ptr_array_index(traceset->traces,i); + timestamp_cur = bt_trace_handle_get_timestamp_end(bt_ctx, currentTrace->id); + if(timestamp_cur > timestamp_max) + timestamp_max = timestamp_cur; + } + } + return timestamp_max; + +} const char *lttv_traceset_get_name_from_event(LttvEvent *event) { diff --git a/lttv/lttv/traceset.h b/lttv/lttv/traceset.h index 65be5efe..6af2e39c 100644 --- a/lttv/lttv/traceset.h +++ b/lttv/lttv/traceset.h @@ -69,6 +69,8 @@ char * lttv_traceset_name(LttvTraceset * s); LttvTrace *lttv_trace_new(LttTrace *t); #endif +void get_absolute_pathname(const gchar *pathname, gchar * abs_pathname); + LttvTraceset *lttv_traceset_copy(LttvTraceset *s_orig); LttvTraceset *lttv_traceset_load(const gchar *filename); @@ -87,6 +89,7 @@ void lttv_traceset_add(LttvTraceset *s, LttvTrace *t); /* * lttv_trace_create : Add all traces recursively to a traceset from a path * + * * ts is the traceset in which will be contained the traces * * trace_path is the path where to find a set of trace. @@ -106,11 +109,6 @@ void lttv_traceset_remove(LttvTraceset *s, unsigned i); LttvAttribute *lttv_traceset_attribute(LttvTraceset *s); - -#ifdef BABEL_CLEANUP -LttTrace *lttv_trace(LttvTrace *t); -#endif - /* Take a position snapshot */ LttvTracesetPosition *lttv_traceset_create_position(LttvTraceset *traceset); @@ -120,6 +118,10 @@ void lttv_traceset_destroy_position(LttvTracesetPosition *traceset_pos); void lttv_traceset_seek_to_position(LttvTracesetPosition *traceset_pos); guint lttv_traceset_get_cpuid_from_event(LttvEvent *event); +/* Returns the minimum timestamp of the traces in the traceset */ +guint64 lttv_traceset_get_timestamp_begin(LttvTraceset *traceset); +/* Returns the maximum timestamp of the traces in the traceset */ +guint64 lttv_traceset_get_timestamp_end(LttvTraceset *traceset); const char *lttv_traceset_get_name_from_event(LttvEvent *event); diff --git a/lttv/modules/gui/Makefile.am b/lttv/modules/gui/Makefile.am index 2c0355a4..bf4c25e2 100644 --- a/lttv/modules/gui/Makefile.am +++ b/lttv/modules/gui/Makefile.am @@ -6,8 +6,8 @@ # WARNING : subdirs order is important : mainWin depends on API -SUBDIRS = lttvwindow controlflow detailedevents statistics filter tracecontrol histogram interrupts resourceview - +SUBDIRS = lttvwindow +# controlflow detailedevents statistics filter tracecontrol histogram interrupts resourceview # TODO: PORT for 0.10 #diskperformance tutorial diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c b/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c index e00a7244..832923c9 100644 --- a/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -37,9 +37,12 @@ #include #include #include +#include +#ifdef BABEL_CLEANUP #include -#include #include +#endif /* BABEL_CLEANUP */ +#include #include #include #include @@ -49,6 +52,10 @@ #include #include +#include +#include +#include + static LttTime lttvwindow_default_time_width = { 1, 0 }; #define CLIP_BUF 256 // size of clipboard buffer @@ -218,13 +225,13 @@ void insert_viewer(GtkWidget* widget, lttvwindow_viewer_constructor constructor) int SetTraceset(Tab * tab, LttvTraceset *traceset) { + guint i; TimeInterval time_span; TimeWindow new_time_window; LttTime new_current_time; - LttvTracesetContext *tsc = - LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); +#ifdef BABEL_CLEANUP // Perform time synchronization on the traces if (syncTraceset(tsc)) { @@ -274,11 +281,17 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset) tsc = LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); } +#endif /*BABEL_CLEANUP*/ - time_span = tsc->time_span; - new_time_window = tab->time_window; - new_current_time = tab->current_time; + time_span.start_time =ltt_time_from_uint64( lttv_traceset_get_timestamp_begin(traceset)); + time_span.end_time = ltt_time_from_uint64(lttv_traceset_get_timestamp_end(traceset)); + + tab->traceset_info->traceset = traceset; + + new_time_window = tab->time_window; + new_current_time = tab->current_time; + /* Set the tab's time window and current time if * out of bounds */ if(ltt_time_compare(tab->time_window.start_time, time_span.start_time) < 0 @@ -311,6 +324,7 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset) current_time_change_manager(tab, new_current_time); return retval; + } /** @@ -698,6 +712,7 @@ void open_traceset(GtkWidget * widget, gpointer user_data) gboolean lttvwindow_process_pending_requests(Tab *tab) { + #ifdef BABEL_CLEANUP LttvTracesetContext *tsc; LttvTracefileContext *tfc; GSList *list_in = NULL; @@ -1476,6 +1491,8 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) NULL); return FALSE; */ + + #endif /* BABEL_CLEANUP */ } #undef list_out @@ -1486,7 +1503,7 @@ static gboolean live_trace_update_handler(Tab *tab) { unsigned int updated_count; - +#ifdef BABEL_CLEANUP LttvTracesetContext *tsc = LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); TimeInterval initial_time_span = tsc->time_span; TimeInterval updated_time_span; @@ -1521,10 +1538,12 @@ live_trace_update_handler(Tab *tab) /* Timer will be recalled as long as there is files to update */ return (updated_count > 0); +#endif /* BABEL_CLEANUP */ } static void lttvwindow_add_trace(Tab *tab, LttvTrace *trace_v) { + #ifdef BABEL_CLEANUP LttvTraceset *traceset = tab->traceset_info->traceset; guint i; guint num_traces = lttv_traceset_number(traceset); @@ -1585,7 +1604,7 @@ static void lttvwindow_add_trace(Tab *tab, LttvTrace *trace_v) (GSourceFunc) live_trace_update_handler, tab); } - +#endif /* BABEL_CLEANUP */ } /* add_trace adds a trace into the current traceset. It first displays a @@ -1595,6 +1614,7 @@ static void lttvwindow_add_trace(Tab *tab, LttvTrace *trace_v) void add_trace(GtkWidget * widget, gpointer user_data) { +#ifdef BABEL_CLEANUP LttTrace *trace; LttvTrace * trace_v; LttvTraceset * traceset; @@ -1699,6 +1719,8 @@ void add_trace(GtkWidget * widget, gpointer user_data) break; } gtk_widget_destroy((GtkWidget*)file_chooser); + +#endif /* BABEL_CLEANUP */ } @@ -1716,6 +1738,7 @@ void add_trace(GtkWidget * widget, gpointer user_data) void remove_trace(GtkWidget *widget, gpointer user_data) { + #ifdef BABEL_CLEANUP LttTrace *trace; LttvTrace * trace_v; LttvTraceset * traceset; @@ -1804,6 +1827,7 @@ void remove_trace(GtkWidget *widget, gpointer user_data) SetTraceset(tab, (gpointer)traceset); } g_free(name); +#endif /* BABEL_CLEANUP */ } #if 0 @@ -2056,6 +2080,7 @@ void save_as(GtkWidget * widget, gpointer user_data) void zoom(GtkWidget * widget, double size) { + #ifdef BABEL_CLEANUP TimeInterval time_span; TimeWindow new_time_window; LttTime current_time, time_delta; @@ -2139,6 +2164,8 @@ void zoom(GtkWidget * widget, double size) } else { time_change_manager(tab, new_time_window); } + +#endif /* BABEL_CLEANUP */ } void zoom_in(GtkWidget * widget, gpointer user_data) @@ -3234,14 +3261,19 @@ on_MNotebook_switch_page (GtkNotebook *notebook, void time_change_manager (Tab *tab, TimeWindow new_time_window) -{ +{ + /* Only one source of time change */ if(tab->time_manager_lock == TRUE) return; tab->time_manager_lock = TRUE; + TimeInterval time_span; + + LttvTraceset *ts = tab->traceset_info->traceset; + time_span.start_time =ltt_time_from_uint64( lttv_traceset_get_timestamp_begin(ts)); + time_span.end_time = ltt_time_from_uint64(lttv_traceset_get_timestamp_end(ts)); + - LttvTracesetContext *tsc = LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); - TimeInterval time_span = tsc->time_span; LttTime start_time = new_time_window.start_time; LttTime end_time = new_time_window.end_time; @@ -3249,7 +3281,8 @@ void time_change_manager (Tab *tab, /* 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); + LttTime upper = ltt_time_sub(time_span.end_time, time_span.start_time); + #if 0 gtk_range_set_increments(GTK_RANGE(tab->scrollbar), ltt_time_to_double(new_time_window.time_width) @@ -3304,6 +3337,8 @@ void time_change_manager (Tab *tab, set_time_window(tab, &new_time_window); tab->time_manager_lock = FALSE; + + } @@ -3326,8 +3361,9 @@ void current_time_change_manager (Tab *tab, } void current_position_change_manager(Tab *tab, - LttvTracesetContextPosition *pos) + LttvTracesetPosition *pos) { + #ifdef BABEL_CLEANUP LttvTracesetContext *tsc = LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); int retval; @@ -3341,11 +3377,13 @@ void current_position_change_manager(Tab *tab, current_time_change_manager(tab, new_time); set_current_position(tab, pos); + #endif /* BABEL_CLEANUP */ } static void on_timebar_starttime_changed(Timebar *timebar, gpointer user_data) { + #ifdef BABEL_CLEANUP Tab *tab = (Tab *)user_data; LttvTracesetContext * tsc = LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); @@ -3377,12 +3415,13 @@ static void on_timebar_starttime_changed(Timebar *timebar, /* Notify the time_manager */ time_change_manager(tab, new_time_window); - +#endif /* BABEL_CLEANUP */ } static void on_timebar_endtime_changed(Timebar *timebar, gpointer user_data) { + #ifdef BABEL_CLEANUP Tab *tab = (Tab *)user_data; LttvTracesetContext * tsc = LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); @@ -3414,6 +3453,7 @@ static void on_timebar_endtime_changed(Timebar *timebar, /* Notify the time_manager */ time_change_manager(tab, new_time_window); + #endif /* BABEL_CLEANUP*/ } static void on_timebar_currenttime_changed(Timebar *timebar, gpointer user_data) @@ -3428,6 +3468,7 @@ static void on_timebar_currenttime_changed(Timebar *timebar, void scroll_value_changed_cb(GtkWidget *scrollbar, gpointer user_data) { + #ifdef BABEL_CLEANUP Tab *tab = (Tab *)user_data; TimeWindow new_time_window; LttTime time; @@ -3485,6 +3526,7 @@ void scroll_value_changed_cb(GtkWidget *scrollbar, /* call viewer hooks for new time window */ set_time_window(tab, &time_window); #endif //0 +#endif /* BABEL_CLEANUP */ } @@ -3855,6 +3897,7 @@ MainWindow *construct_main_window(MainWindow * parent) void tab_destructor(LttvPluginTab * ptab) { +#ifdef BABEL_CLEANUP int i, nb, ref_count; LttvTrace * trace; Tab *tab = ptab->tab; @@ -3893,6 +3936,7 @@ void tab_destructor(LttvPluginTab * ptab) g_free(tab->traceset_info); //g_free(tab); g_object_unref(ptab); +#endif /* BABEL_CLEANUP */ } @@ -3902,6 +3946,7 @@ void tab_destructor(LttvPluginTab * ptab) void init_tab(Tab *tab, MainWindow * mw, Tab *copy_tab, GtkNotebook * notebook, char * label) { + GList * list; //Tab * tab; //LttvFilter *filter = NULL; @@ -3919,9 +3964,13 @@ void init_tab(Tab *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 */ + +#ifdef BABEL_CLEANUP tab->filter = lttv_filter_clone(copy_tab->filter); +#endif /* BABEL_CLEANUP */ } else { tab->traceset_info->traceset = lttv_traceset_new(); + tab->filter = NULL; } #ifdef DEBUG @@ -3931,21 +3980,17 @@ void init_tab(Tab *tab, MainWindow * mw, Tab *copy_tab, 0, 4); fflush(stdout); #endif //DEBUG - +// tab->time_manager_lock = FALSE; tab->current_time_manager_lock = FALSE; - +#ifdef BABEL_CLEANUP //FIXME copy not implemented in lower level tab->traceset_info->traceset_context = g_object_new(LTTV_TRACESET_STATS_TYPE, NULL); - g_assert(tab->traceset_info->traceset_context != NULL); - lttv_context_init( - LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context), - tab->traceset_info->traceset); //add state update hooks lttv_state_add_event_hooks( (LttvTracesetState*)tab->traceset_info->traceset_context); - +#endif //BABEL_CLEANUP //determine the current_time and time_window of the tab #if 0 if(copy_tab != NULL){ @@ -4110,7 +4155,7 @@ void init_tab(Tab *tab, MainWindow * mw, Tab *copy_tab, lttvwindow_report_time_window(tab, time_window); lttvwindow_report_current_time(tab, ltt_time_zero); } - + LttvTraceset *traceset = tab->traceset_info->traceset; SetTraceset(tab, traceset); } @@ -4128,8 +4173,9 @@ gboolean execute_events_requests(Tab *tab) } -__EXPORT void create_main_window_with_trace_list(GSList *traces, gboolean is_live) +__EXPORT void create_main_window_with_trace_list(GSList *traces) { + GSList *iter = NULL; /* Create window */ @@ -4149,24 +4195,19 @@ __EXPORT void create_main_window_with_trace_list(GSList *traces, gboolean is_liv ptab = (LttvPluginTab *)g_object_get_data(G_OBJECT(page), "Tab_Plugin"); tab = ptab->tab; } - + + LttvTraceset * traceset = lttv_traceset_new(); for(iter=traces; iter!=NULL; iter=g_slist_next(iter)) { gchar *path = (gchar*)iter->data; /* Add trace */ gchar abs_path[PATH_MAX]; - LttvTrace *trace_v; - LttTrace *trace; + get_absolute_pathname(path, abs_path); - trace_v = lttvwindowtraces_get_trace_by_name(abs_path); - if(trace_v == NULL) { - if(is_live) { - trace = ltt_trace_open_live(abs_path); - } else { - trace = ltt_trace_open(abs_path); - } - if(trace == NULL) { - g_warning("cannot open trace %s", abs_path); + + if(lttv_traceset_add_path(traceset,abs_path) != 0 ){ /*failure*/ + + g_warning("cannot open trace %s", abs_path); GtkWidget *dialogue = gtk_message_dialog_new( @@ -4178,19 +4219,10 @@ __EXPORT void create_main_window_with_trace_list(GSList *traces, gboolean is_liv "to select it ?"); gtk_dialog_run(GTK_DIALOG(dialogue)); gtk_widget_destroy(dialogue); - } else { - trace_v = lttv_trace_new(trace); - lttvwindowtraces_add_trace(trace_v); - lttvwindow_add_trace(tab, trace_v); - } - } else { - lttvwindow_add_trace(tab, trace_v); } - } - - LttvTraceset *traceset; - - traceset = tab->traceset_info->traceset; - SetTraceset(tab, traceset); + else{ + SetTraceset(tab, traceset); + } + } } diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h b/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h index b4373b80..1bbd4fbf 100644 --- a/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h +++ b/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h @@ -27,7 +27,7 @@ MainWindow *construct_main_window(MainWindow * parent); void main_window_free(MainWindow * mw); void main_window_destructor(MainWindow * mw); -void create_main_window_with_trace_list(GSList *traces, gboolean is_live); +void create_main_window_with_trace_list(GSList *traces); void insert_viewer_wrap(GtkWidget *menuitem, gpointer user_data); gboolean execute_events_requests(Tab *tab); diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/init_module.c b/lttv/modules/gui/lttvwindow/lttvwindow/init_module.c index 5b828957..03e25810 100644 --- a/lttv/modules/gui/lttvwindow/lttvwindow/init_module.c +++ b/lttv/modules/gui/lttvwindow/lttvwindow/init_module.c @@ -34,9 +34,11 @@ #include #include #include -#include + #include +#ifdef BABEL_CLEANUP #include +#endif /* BABEL_CLEANUP */ #include #include #include @@ -125,7 +127,7 @@ static gboolean window_creation_hook(void *hook_data, void *call_data) add_pixmap_directory ("../modules/gui/main/pixmaps"); /* First window, use command line trace */ - create_main_window_with_trace_list(g_init_trace, a_live); + create_main_window_with_trace_list(g_init_trace); gtk_main (); @@ -187,7 +189,7 @@ static void init() { g_assert((main_hooks = *(value.v_pointer)) != NULL); lttv_hooks_add(main_hooks, window_creation_hook, NULL, LTTV_PRIO_DEFAULT); - +#ifdef BABEL_CLEANUP { /* Register state calculator */ LttvHooks *hook_adder = lttv_hooks_new(); @@ -227,6 +229,7 @@ static void init() { after_request, NULL, NULL, hook_adder, hook_remover); } +#endif /* BABEL_CLEANUP */ } void @@ -267,4 +270,4 @@ static void destroy() { LTTV_MODULE("lttvwindow", "Viewer main window", \ "Viewer with multiple windows, tabs and panes for graphical modules", \ - init, destroy, "stats", "option", "sync") + init, destroy, "option","state") diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/lttv_plugin_tab.c b/lttv/modules/gui/lttvwindow/lttvwindow/lttv_plugin_tab.c index 70591766..519e5d2f 100644 --- a/lttv/modules/gui/lttvwindow/lttvwindow/lttv_plugin_tab.c +++ b/lttv/modules/gui/lttvwindow/lttvwindow/lttv_plugin_tab.c @@ -32,12 +32,13 @@ static void tab_update_filter(LttvPlugin *parent, LttvFilter *filter) { LttvPluginTab *self = LTTV_PLUGIN_TAB(parent); g_message("In tab update filter."); + #ifdef BABEL_CLEANUP lttv_filter_destroy(self->tab->filter); + #endif /* BABEL_CLEANUP */ self->tab->filter = filter; lttvwindow_report_filter(self->tab, filter); } - static void lttv_plugin_tab_class_init (LttvPluginTabClass *klass) { diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c b/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c index 56a847e6..60c18157 100644 --- a/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c +++ b/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c @@ -35,8 +35,9 @@ #include #include #include +#ifdef BABEL_CLEANUP #include -#include +#endif /* BABEL_CLEANUP */ #include #include #include @@ -115,8 +116,10 @@ void set_current_time(Tab *tab, const LttTime *current_time) * This is called whenever the current time value changes. */ -void set_current_position(Tab *tab, const LttvTracesetContextPosition *pos) +void set_current_position(Tab *tab, const LttvTracesetPosition *pos) { + #ifdef BABEL_CLEANUP + LttvAttributeValue value; LttvHooks * tmp; gboolean retval; @@ -130,6 +133,7 @@ void set_current_position(Tab *tab, const LttvTracesetContextPosition *pos) if (tmp != NULL) { lttv_hooks_call(tmp, (void *) pos); } +#endif /*BABEL_CLEANUP*/ } void add_toolbar_constructor(MainWindow *mw, LttvToolbarClosure *toolbar_c) @@ -1008,7 +1012,7 @@ __EXPORT void lttvwindow_report_current_time(Tab *tab, */ __EXPORT void lttvwindow_report_current_position(Tab *tab, - LttvTracesetContextPosition *pos) + LttvTracesetPosition *pos) { current_position_change_manager(tab, pos); } @@ -1214,7 +1218,7 @@ void lttvwindow_report_filter(Tab *tab, LttvFilter *filter) lttv_hooks_call(tmp, filter); } - +#ifdef BABEL_CLEANUP /** * Function to get the stats of the traceset @@ -1225,15 +1229,11 @@ __EXPORT LttvTracesetStats* lttvwindow_get_traceset_stats(Tab *tab) { return tab->traceset_info->traceset_context; } - -__EXPORT LttvTracesetContext* lttvwindow_get_traceset_context(Tab *tab) -{ - return (LttvTracesetContext*)tab->traceset_info->traceset_context; -} - +#endif /*BABEL_CLEANUP*/ void events_request_free(EventsRequest *events_request) { + #ifdef BABEL_CLEANUP if(events_request == NULL) return; if(events_request->start_position != NULL) @@ -1267,10 +1267,10 @@ void events_request_free(EventsRequest *events_request) lttv_hooks_destroy(events_request->after_request); g_free(events_request); + #endif /*BABEL_CLEANUP*/ } - __EXPORT GtkWidget *main_window_get_widget(Tab *tab) { return tab->mw->mwindow; diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h b/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h index 42a8ba30..03ff9cc0 100644 --- a/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h +++ b/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h @@ -255,9 +255,11 @@ FIXME : explain other important events #include #include #include -#include +#ifdef BABEL_CLEANUP #include + #include +#endif /* BABEL_CLEANUP */ #include #include @@ -663,7 +665,7 @@ void lttvwindow_report_current_time(Tab *tab, */ void lttvwindow_report_current_position(Tab *tab, - LttvTracesetContextPosition *pos); + LttvTracesetPosition *pos); /** * Function to set the position of the hpane's dividor (viewer). @@ -684,18 +686,17 @@ typedef struct _EventsRequest { gpointer viewer_data; /* Unset : NULL */ gboolean servicing; /* service in progress: TRUE*/ LttTime start_time; /* Unset : ltt_time_infinite*/ - LttvTracesetContextPosition *start_position; /* Unset : NULL */ + LttvTracesetPosition *start_position; /* Unset : NULL */ gboolean stop_flag; /* Continue:TRUE Stop:FALSE */ LttTime end_time; /* Unset : ltt_time_infinite*/ guint num_events; /* Unset : G_MAXUINT */ - LttvTracesetContextPosition *end_position; /* Unset : NULL */ + LttvTracesetPosition *end_position; /* Unset : NULL */ gint trace; /* unset : -1 */ GArray *hooks; /* Unset : NULL */ LttvHooks *before_chunk_traceset; /* Unset : NULL */ LttvHooks *before_chunk_trace; /* Unset : NULL */ LttvHooks *before_chunk_tracefile;/* Unset : NULL */ LttvHooks *event; /* Unset : NULL */ - LttvHooksByIdChannelArray *event_by_id_channel;/* Unset : NULL */ LttvHooks *after_chunk_tracefile; /* Unset : NULL */ LttvHooks *after_chunk_trace; /* Unset : NULL */ LttvHooks *after_chunk_traceset; /* Unset : NULL */ @@ -806,7 +807,7 @@ LttTime lttvwindow_get_current_time(Tab *tab); void lttvwindow_report_filter(Tab *tab, LttvFilter *filter); - +#ifdef BABEL_CLEANUP /** * Function to get the stats of the traceset @@ -817,16 +818,7 @@ void lttvwindow_report_filter(Tab *tab, LttvFilter *filter); */ LttvTracesetStats* lttvwindow_get_traceset_stats(Tab *tab); - -/** - * Function to get the context of the traceset - * It must be non const so the viewer can add and remove hooks from it. - * @param tab the tab the viewer belongs to. - * @return Context of the current tab. - */ - - -LttvTracesetContext* lttvwindow_get_traceset_context(Tab *tab); +#endif /*BABEL_CLEANUP*/ /* set_time_window @@ -858,7 +850,7 @@ void events_request_free(EventsRequest *events_request); GtkWidget *main_window_get_widget(Tab *tab); -void set_current_position(Tab *tab, const LttvTracesetContextPosition *pos); +void set_current_position(Tab *tab, const LttvTracesetPosition *pos); /** @@ -881,6 +873,6 @@ static inline void lttvwindow_events_request_enable(void) void current_position_change_manager(Tab *tab, - LttvTracesetContextPosition *pos); + LttvTracesetPosition *pos); #endif //LTTVWINDOW_H diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c b/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c index 05ab4b43..80efe432 100644 --- a/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c +++ b/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #include // for CHUNK_NUM_EVENTS #include /* for main window structure */ @@ -56,7 +55,7 @@ typedef struct _BackgroundNotify { gpointer owner; LttvTrace *trace; /* trace */ LttTime notify_time; - LttvTracesetContextPosition *notify_position; + LttvTracesetPosition *notify_position; LttvHooks *notify; /* Hook to call when the notify is passed, or at the end of trace */ } BackgroundNotify; @@ -75,6 +74,7 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace); __EXPORT LttvTrace *lttvwindowtraces_get_trace_by_name(gchar *path) { +#ifdef BABEL_CLEANUP guint i; for(i=0;itraceset->filename); gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(widget)); g_signal_connect_swapped (dialog, "response", G_CALLBACK (destroy_dialog), @@ -501,9 +503,10 @@ __EXPORT void lttvwindowtraces_background_notify_queue (gpointer owner, LttvTrace *trace, LttTime notify_time, - const LttvTracesetContextPosition *notify_position, + const LttvTracesetPosition *notify_position, const LttvHooks *notify) { + #ifdef BABEL_CLEANUP BackgroundNotify *bg_notify; LttvAttribute *attribute = lttv_trace_attribute(trace); LttvAttributeValue value; @@ -524,7 +527,7 @@ __EXPORT void lttvwindowtraces_background_notify_queue &value); g_assert(result); - LttvTracesetContext *tsc = (LttvTracesetContext*)(value.v_pointer); + LttvTraceset *ts = (LttvTraceset)(value.v_pointer); bg_notify = g_new(BackgroundNotify,1); @@ -543,6 +546,7 @@ __EXPORT void lttvwindowtraces_background_notify_queue lttv_hooks_add_list(bg_notify->notify, notify); *slist = g_slist_append(*slist, bg_notify); +#endif /* BABEL_CLEANUP*/ } /** @@ -560,9 +564,10 @@ __EXPORT void lttvwindowtraces_background_notify_current (gpointer owner, LttvTrace *trace, LttTime notify_time, - const LttvTracesetContextPosition *notify_position, + const LttvTracesetPosition *notify_position, const LttvHooks *notify) { + #ifdef BABEL_CLEANUP BackgroundNotify *bg_notify; LttvAttribute *attribute = lttv_trace_attribute(trace); LttvAttributeValue value; @@ -602,11 +607,13 @@ __EXPORT void lttvwindowtraces_background_notify_current lttv_hooks_add_list(bg_notify->notify, notify); *slist = g_slist_append(*slist, bg_notify); + #endif /* BABEL_CLEANUP */ } static void notify_request_free(BackgroundNotify *notify_req) { + #ifdef BABEL_CLEANUP if(notify_req == NULL) return; if(notify_req->notify_position != NULL) @@ -614,6 +621,7 @@ static void notify_request_free(BackgroundNotify *notify_req) if(notify_req->notify != NULL) lttv_hooks_destroy(notify_req->notify); g_free(notify_req); + #endif /* BABEL_CLEANUP */ } /** @@ -688,9 +696,10 @@ __EXPORT void lttvwindowtraces_background_notify_remove(gpointer owner) /* Background processing helper functions */ void lttvwindowtraces_add_computation_hooks(LttvAttributeName module_name, - LttvTracesetContext *tsc, + LttvTraceset *ts, LttvHooks *hook_adder) { + #ifdef BABEL_CLEANUP LttvAttribute *g_attribute = lttv_global_attributes(); LttvAttribute *module_attribute; LttvAttributeType type; @@ -717,12 +726,14 @@ void lttvwindowtraces_add_computation_hooks(LttvAttributeName module_name, if(hook_adder != NULL) lttv_hooks_add_list(hook_adder, (LttvHooks*)*(value.v_pointer)); } +#endif /* BABEL_CLEANUP */ } void lttvwindowtraces_remove_computation_hooks(LttvAttributeName module_name, - LttvTracesetContext *tsc, + LttvTraceset *ts, LttvHooks *hook_remover) { + #ifdef BABEL_CLEANUP LttvAttribute *g_attribute = lttv_global_attributes(); LttvAttribute *module_attribute; LttvAttributeType type; @@ -748,11 +759,13 @@ void lttvwindowtraces_remove_computation_hooks(LttvAttributeName module_name, if(hook_remover != NULL) lttv_hooks_add_list(hook_remover, (LttvHooks*)*(value.v_pointer)); } + #endif /* BABEL_CLEANUP */ } void lttvwindowtraces_call_before_chunk(LttvAttributeName module_name, - LttvTracesetContext *tsc) + LttvTraceset *ts) { + #ifdef BABEL_CLEANUP LttvAttribute *g_attribute = lttv_global_attributes(); LttvAttribute *module_attribute; LttvAttributeType type; @@ -816,12 +829,13 @@ void lttvwindowtraces_call_before_chunk(LttvAttributeName module_name, before_chunk_tracefile, event_hook, event_hook_by_id_channel); +#endif /* BABEL_CLEANUP */ } void lttvwindowtraces_call_after_chunk(LttvAttributeName module_name, - LttvTracesetContext *tsc) + LttvTraceset *ts) { LttvAttribute *g_attribute = lttv_global_attributes(); LttvAttribute *module_attribute; @@ -831,7 +845,6 @@ void lttvwindowtraces_call_after_chunk(LttvAttributeName module_name, LttvHooks *after_chunk_trace=NULL; LttvHooks *after_chunk_tracefile=NULL; LttvHooks *event_hook=NULL; - LttvHooksByIdChannelArray *event_hook_by_id_channel=NULL; module_attribute = LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(g_attribute), @@ -875,16 +888,13 @@ void lttvwindowtraces_call_after_chunk(LttvAttributeName module_name, type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(module_attribute), LTTV_EVENT_HOOK_BY_ID_CHANNEL, &value); - if(type == LTTV_POINTER) { - event_hook_by_id_channel = (LttvHooksByIdChannelArray*)*(value.v_pointer); - } - + #ifdef BABEL_CLEANUP lttv_process_traceset_end(tsc, after_chunk_traceset, after_chunk_trace, after_chunk_tracefile, - event_hook, - event_hook_by_id_channel); + event_hook); +#endif /* BABEL_CLEANUP*/ } @@ -1014,10 +1024,8 @@ static gint find_window_widget(MainWindow *a, GtkWidget *b) gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace) { - LttvTracesetContext *tsc; - LttvTracesetStats *tss; + LttvTraceset *tsc; LttvTraceset *ts; - //LttvTracesetContextPosition *sync_position; LttvAttribute *attribute; LttvAttribute *g_attribute = lttv_global_attributes(); GSList **list_out, **list_in, **notify_in, **notify_out; @@ -1062,14 +1070,6 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace) g_assert(type == LTTV_POINTER); ts = (LttvTraceset*)*(value.v_pointer); - type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute), - LTTV_COMPUTATION_TRACESET_CONTEXT, - &value); - g_assert(type == LTTV_POINTER); - tsc = (LttvTracesetContext*)*(value.v_pointer); - tss = (LttvTracesetStats*)*(value.v_pointer); - g_assert(LTTV_IS_TRACESET_CONTEXT(tsc)); - g_assert(LTTV_IS_TRACESET_STATS(tss)); #if 0 type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute), LTTV_COMPUTATION_SYNC_POSITION, @@ -1077,6 +1077,7 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace) g_assert(type == LTTV_POINTER); sync_position = (LttvTracesetContextPosition*)*(value.v_pointer); #endif //0 +#ifdef BABEL_CLEANUP /* There is no events requests pending : we should never have been called! */ g_assert(g_slist_length(*list_out) != 0 || g_slist_length(*list_in) != 0); /* 0.1 Lock traces */ @@ -1084,9 +1085,9 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace) guint iter_trace=0; for(iter_trace=0; - iter_tracets); + iter_tracets); iter_trace++) { - LttvTrace *trace_v = lttv_traceset_get(tsc->ts,iter_trace); + LttvTrace *trace_v = lttv_traceset_get(ts->ts,iter_trace); if(lttvwindowtraces_lock(trace_v) != 0) return TRUE; /* Cannot get trace lock, try later */ @@ -1487,6 +1488,7 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace) lttvwindowtraces_unlock(trace_v); } } + #endif /* BABEL_CLEANUP */ return ret_val; } @@ -1509,7 +1511,6 @@ void lttvwindowtraces_register_computation_hooks(LttvAttributeName module_name, LttvHooks *before_request, LttvHooks *after_request, LttvHooks *event_hook, - LttvHooksById *event_hook_by_id_channel, LttvHooks *hook_adder, LttvHooks *hook_remover) { @@ -1592,13 +1593,6 @@ void lttvwindowtraces_register_computation_hooks(LttvAttributeName module_name, g_assert(result); *(value.v_pointer) = event_hook; - result = lttv_iattribute_find(LTTV_IATTRIBUTE(attribute), - LTTV_EVENT_HOOK_BY_ID_CHANNEL, - LTTV_POINTER, - &value); - g_assert(result); - *(value.v_pointer) = event_hook_by_id_channel; - result = lttv_iattribute_find(LTTV_IATTRIBUTE(attribute), LTTV_HOOK_ADDER, LTTV_POINTER, @@ -1832,10 +1826,6 @@ void lttvwindowtraces_unregister_computation_hooks &value); g_assert(result); - LttvHooksByIdChannelArray *event_hook_by_id_channel = (LttvHooksByIdChannelArray*)*(value.v_pointer); - if(event_hook_by_id_channel != NULL) - lttv_hooks_by_id_channel_destroy(event_hook_by_id_channel); - result = lttv_iattribute_find(LTTV_IATTRIBUTE(attribute), LTTV_HOOK_ADDER, LTTV_POINTER, diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.h b/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.h index 45ad7e22..6d7c061b 100644 --- a/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.h +++ b/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.h @@ -186,7 +186,7 @@ void lttvwindowtraces_background_notify_queue (gpointer owner, LttvTrace *trace, LttTime notify_time, - const LttvTracesetContextPosition *notify_position, + const LttvTracesetPosition *notify_position, const LttvHooks *notify); /** @@ -204,7 +204,7 @@ void lttvwindowtraces_background_notify_current (gpointer owner, LttvTrace *trace, LttTime notify_time, - const LttvTracesetContextPosition *notify_position, + const LttvTracesetPosition *notify_position, const LttvHooks *notify); /** @@ -263,7 +263,6 @@ void lttvwindowtraces_register_computation_hooks(LttvAttributeName module_name, LttvHooks *before_request, LttvHooks *after_request, LttvHooks *event_hook, - LttvHooksById *event_hook_by_id, LttvHooks *hook_adder, LttvHooks *hook_remover); /** diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/mainwindow-private.h b/lttv/modules/gui/lttvwindow/lttvwindow/mainwindow-private.h index 5311fa15..3770e12a 100644 --- a/lttv/modules/gui/lttvwindow/lttvwindow/mainwindow-private.h +++ b/lttv/modules/gui/lttvwindow/lttvwindow/mainwindow-private.h @@ -24,9 +24,12 @@ #include #include #include -#include + #include +#ifdef BABEL_CLEANUP +#include #include +#endif /* BABEL_CLEANUP */ #include //#include #include @@ -34,8 +37,7 @@ #define SCROLL_STEP_PER_PAGE 10.0 struct _TracesetInfo { - //FIXME? TracesetContext and stats in same or different variable ? - LttvTracesetStats * traceset_context; + //FIXME? Traceset is the unique member of tracesetinfo LttvTraceset * traceset; }; diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/support.c b/lttv/modules/gui/lttvwindow/lttvwindow/support.c index ce92ef05..1374d566 100644 --- a/lttv/modules/gui/lttvwindow/lttvwindow/support.c +++ b/lttv/modules/gui/lttvwindow/lttvwindow/support.c @@ -32,7 +32,7 @@ #include -#include +#include #include "support.h" diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/timebar.c b/lttv/modules/gui/lttvwindow/lttvwindow/timebar.c index 9673ec66..0395b814 100644 --- a/lttv/modules/gui/lttvwindow/lttvwindow/timebar.c +++ b/lttv/modules/gui/lttvwindow/lttvwindow/timebar.c @@ -242,15 +242,9 @@ void timebar_set_minmax_time(Timebar *timebar, ) { return; } - - if (min_time != NULL) { - timebar->min_time = *min_time; - } - - if (max_time != NULL) { - timebar->max_time = *max_time; - } - + /* null-checked already */ + timebar->min_time = *min_time; + timebar->max_time = *max_time; if (ltt_time_compare(timebar->min_time, timebar->max_time) == 0) { diff --git a/lttv/modules/text/textDump.c b/lttv/modules/text/textDump.c index a8fadb5d..a09c8b79 100644 --- a/lttv/modules/text/textDump.c +++ b/lttv/modules/text/textDump.c @@ -35,6 +35,7 @@ #include #include #endif +// #include #include #include #include diff --git a/runlttv b/runlttv index 9dfc6bf8..70e23621 100755 --- a/runlttv +++ b/runlttv @@ -15,15 +15,15 @@ BUILDPATH=$(dirname $0) RCFILE="$(dirname $0)/.runlttvrc" TEXTLIBS="-L ${BUILDPATH}/lttv/modules/text/.libs -m textDump" EVALLIBS="-L ${BUILDPATH}/lttv/modules/text/.libs -m sync_chain_batch" -GRAPHLIBS="-L ${BUILDPATH}/lttv/modules/gui/lttvwindow/lttvwindow/.libs -m lttvwindow "\ -"-L ${BUILDPATH}/lttv/modules/gui/controlflow/.libs -m guicontrolflow "\ -"-L ${BUILDPATH}/lttv/modules/gui/detailedevents/.libs -m guievents "\ -"-L ${BUILDPATH}/lttv/modules/gui/tracecontrol/.libs -m guitracecontrol "\ -"-L ${BUILDPATH}/lttv/modules/gui/statistics/.libs -m guistatistics "\ -"-L ${BUILDPATH}/lttv/modules/gui/resourceview/.libs -m resourceview "\ -"-L ${BUILDPATH}/lttv/modules/gui/filter/.libs -m guifilter "\ -"-L ${BUILDPATH}/lttv/modules/gui/interrupts/.libs -m interrupts "\ -"-L ${BUILDPATH}/lttv/modules/gui/histogram/.libs -m guihistogram" +GRAPHLIBS="-L ${BUILDPATH}/lttv/modules/gui/lttvwindow/lttvwindow/.libs -m lttvwindow" +#"-L ${BUILDPATH}/lttv/modules/gui/controlflow/.libs -m guicontrolflow "\ +#"-L ${BUILDPATH}/lttv/modules/gui/detailedevents/.libs -m guievents "\ +#"-L ${BUILDPATH}/lttv/modules/gui/tracecontrol/.libs -m guitracecontrol "\ +#"-L ${BUILDPATH}/lttv/modules/gui/statistics/.libs -m guistatistics "\ +#"-L ${BUILDPATH}/lttv/modules/gui/resourceview/.libs -m resourceview "\ +#"-L ${BUILDPATH}/lttv/modules/gui/filter/.libs -m guifilter "\ +#"-L ${BUILDPATH}/lttv/modules/gui/interrupts/.libs -m interrupts "\ +#"-L ${BUILDPATH}/lttv/modules/gui/histogram/.libs -m guihistogram" DEFAULTMODE="gui" usage () {