X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmodules%2Fgui%2Flttvwindow%2Flttvwindow%2Finit_module.c;h=8c3f97296167e33bb44db14f47f24e4b02744c82;hb=5e96e7e38fc3a40f0d9076c7ca8f369ad8c91d8c;hp=89d7fea7e03e0227ea37aca04706ea5c1d4f5ff1;hpb=91fd6881c35fd1146aafc67a803626f733cbeb14;p=lttv.git diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/init_module.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/init_module.c index 89d7fea7..8c3f9729 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/init_module.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/init_module.c @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -50,12 +51,14 @@ LttvTraceInfo LTTV_TRACES, LTTV_COMPUTATION, + LTTV_VIEWER_CONSTRUCTORS, LTTV_REQUESTS_QUEUE, LTTV_REQUESTS_CURRENT, LTTV_NOTIFY_QUEUE, LTTV_NOTIFY_CURRENT, LTTV_COMPUTATION_TRACESET, LTTV_COMPUTATION_TRACESET_CONTEXT, + LTTV_COMPUTATION_SYNC_POSITION, LTTV_BEFORE_CHUNK_TRACESET, LTTV_BEFORE_CHUNK_TRACE, LTTV_BEFORE_CHUNK_TRACEFILE, @@ -80,27 +83,17 @@ LttvHooks *main_hooks; /* Initial trace from command line */ -LttvTrace *g_init_trace = NULL; +//LttvTrace *g_init_trace = NULL; static char *a_trace; +static char g_init_trace[PATH_MAX] = ""; void lttv_trace_option(void *hook_data) { LttTrace *trace; - gchar abs_path[PATH_MAX]; - - get_absolute_pathname(a_trace, abs_path); - g_init_trace = lttvwindowtraces_get_trace_by_name(abs_path); - if(g_init_trace == NULL) { - trace = ltt_trace_open(abs_path); - if(trace == NULL) { - g_warning("cannot open trace %s", abs_path); - } else { - g_init_trace = lttv_trace_new(trace); - lttvwindowtraces_add_trace(g_init_trace); - } - } + + get_absolute_pathname(a_trace, g_init_trace); } /***************************************************************************** @@ -128,7 +121,12 @@ static gboolean window_creation_hook(void *hook_data, void *call_data) add_pixmap_directory ("pixmaps"); add_pixmap_directory ("../modules/gui/main/pixmaps"); - construct_main_window(NULL); + /* First window, use command line trace */ + if(strcmp(g_init_trace, "") != 0){ + create_main_window_with_trace(g_init_trace); + } else { + construct_main_window(NULL); + } gtk_main (); @@ -144,6 +142,7 @@ static void init() { LTTV_TRACES = g_quark_from_string("traces"); LTTV_COMPUTATION = g_quark_from_string("computation"); + LTTV_VIEWER_CONSTRUCTORS = g_quark_from_string("viewer_constructors"); LTTV_REQUESTS_QUEUE = g_quark_from_string("requests_queue"); LTTV_REQUESTS_CURRENT = g_quark_from_string("requests_current"); LTTV_NOTIFY_QUEUE = g_quark_from_string("notify_queue"); @@ -151,6 +150,8 @@ static void init() { LTTV_COMPUTATION_TRACESET = g_quark_from_string("computation_traceset"); LTTV_COMPUTATION_TRACESET_CONTEXT = g_quark_from_string("computation_traceset_context"); + LTTV_COMPUTATION_SYNC_POSITION = + g_quark_from_string("computation_sync_position"); LTTV_BEFORE_CHUNK_TRACESET = g_quark_from_string("before_chunk_traceset"); LTTV_BEFORE_CHUNK_TRACE = g_quark_from_string("before_chunk_trace"); LTTV_BEFORE_CHUNK_TRACEFILE = g_quark_from_string("before_chunk_tracefile"); @@ -185,9 +186,13 @@ static void init() { LttvHooks *hook_adder = lttv_hooks_new(); lttv_hooks_add(hook_adder, lttv_state_save_hook_add_event_hooks, NULL, LTTV_PRIO_DEFAULT); + lttv_hooks_add(hook_adder, lttv_state_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); + lttv_hooks_add(hook_remover, lttv_state_hook_remove_event_hooks, + NULL, LTTV_PRIO_DEFAULT); /* Add state computation background hook adder to attributes */ lttvwindowtraces_register_computation_hooks(g_quark_from_string("state"), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, @@ -199,9 +204,13 @@ static void init() { LttvHooks *hook_adder = lttv_hooks_new(); lttv_hooks_add(hook_adder, lttv_stats_hook_add_event_hooks, NULL, LTTV_PRIO_DEFAULT); + lttv_hooks_add(hook_adder, lttv_state_hook_add_event_hooks, NULL, + LTTV_PRIO_DEFAULT); LttvHooks *hook_remover = lttv_hooks_new(); lttv_hooks_add(hook_remover, lttv_stats_hook_remove_event_hooks, NULL, LTTV_PRIO_DEFAULT); + lttv_hooks_add(hook_remover, lttv_state_hook_remove_event_hooks, + NULL, LTTV_PRIO_DEFAULT); LttvHooks *after_request = lttv_hooks_new(); lttv_hooks_add(after_request, lttv_stats_sum_traceset_hook, NULL, LTTV_PRIO_DEFAULT); @@ -220,6 +229,10 @@ main_window_destructor(MainWindow * mw) gtk_widget_destroy(mw->mwindow); } +static void destroy_walk(gpointer data, gpointer user_data) +{ + main_window_destructor((MainWindow*)data); +} /** * plugin's destroy function @@ -233,23 +246,15 @@ static void destroy() { LttvTrace *trace; GSList *iter = NULL; - 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")); - lttv_option_remove("trace"); lttv_hooks_remove_data(main_hooks, window_creation_hook, NULL); g_debug("GUI destroy()"); - if(g_main_window_list){ - for(iter=g_main_window_list;iter!=NULL;iter=g_slist_next(iter)) { - main_window_destructor((MainWindow*)iter->data); - } - g_slist_free(g_main_window_list); - } + g_slist_foreach(g_main_window_list, destroy_walk, NULL); + + g_slist_free(g_main_window_list); }