From: compudj Date: Wed, 28 Jul 2004 21:49:40 +0000 (+0000) Subject: init trace scrollbar bugfix X-Git-Tag: v0.12.20~2847 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=91fd6881c35fd1146aafc67a803626f733cbeb14;p=lttv.git init trace scrollbar bugfix git-svn-id: http://ltt.polymtl.ca/svn@642 04897980-b3bd-0310-b5e0-8ef037075253 --- 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 3659ae58..53fb93c2 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -1384,9 +1384,10 @@ static void lttvwindow_add_trace(Tab *tab, LttvTrace *trace_v) { LttvTraceset *traceset = tab->traceset_info->traceset; guint i; + guint num_traces = lttv_traceset_number(traceset); //Verify if trace is already present. - for(i=0; itraceset_info->traceset; + SetTraceset(new_tab, traceset); } } 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 7b2d8c7d..89d7fea7 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 @@ -88,7 +88,7 @@ static char *a_trace; void lttv_trace_option(void *hook_data) { LttTrace *trace; - gchar *abs_path; + gchar abs_path[PATH_MAX]; get_absolute_pathname(a_trace, abs_path); g_init_trace = lttvwindowtraces_get_trace_by_name(abs_path); @@ -180,16 +180,37 @@ static void init() { lttv_hooks_add(main_hooks, window_creation_hook, NULL, LTTV_PRIO_DEFAULT); - 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); - /* 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, - hook_adder, hook_remover); + { + /* Register state calculator */ + 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); + /* 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, + hook_adder, hook_remover); + } + + { + /* Register statistics calculator */ + LttvHooks *hook_adder = lttv_hooks_new(); + lttv_hooks_add(hook_adder, lttv_stats_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); + LttvHooks *after_request = lttv_hooks_new(); + lttv_hooks_add(after_request, lttv_stats_sum_traceset_hook, NULL, + LTTV_PRIO_DEFAULT); + /* Add state computation background hook adder to attributes */ + lttvwindowtraces_register_computation_hooks(g_quark_from_string("stats"), + NULL, NULL, NULL, NULL, NULL, NULL, NULL, + after_request, NULL, NULL, + hook_adder, hook_remover); + } } void @@ -212,7 +233,9 @@ 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"); diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c index 156ea7d3..b210fbba 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c @@ -283,7 +283,10 @@ void lttvwindowtraces_background_request_queue { BackgroundRequest *bg_req; LttvAttribute *attribute = lttv_trace_attribute(trace); + LttvAttribute *g_attribute = lttv_global_attributes(); + LttvAttribute *module_attribute; LttvAttributeValue value; + LttvAttributeType type; GSList **slist; guint num; @@ -292,7 +295,21 @@ void lttvwindowtraces_background_request_queue LTTV_POINTER, &value)); slist = (GSList**)(value.v_pointer); - + + /* Verify that the calculator is loaded */ + g_assert(module_attribute = + LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(g_attribute), + LTTV_COMPUTATION))); + + + type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(module_attribute), + g_quark_from_string(module_name), + &value); + if(type == LTTV_NONE) { + g_critical("Missing background calculator %s", module_name); + return; + } + bg_req = g_new(BackgroundRequest,1); bg_req->module_name = g_quark_from_string(module_name); bg_req->trace = trace; @@ -800,10 +817,12 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace) LttvTracesetStats *tss; LttvTraceset *ts; LttvAttribute *attribute; + LttvAttribute *g_attribute = lttv_global_attributes(); GSList **list_out, **list_in, **notify_in, **notify_out; LttvAttributeValue value; LttvAttributeType type; gboolean ret_val; + LttvHooks *before_request, *after_request; if(trace == NULL) return FALSE; @@ -908,9 +927,32 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace) while(iter != NULL) { BackgroundRequest *bg_req = (BackgroundRequest*)iter->data; - /*- add hooks to context*/ + /* - set hooks'in_progress flag to TRUE */ lttvwindowtraces_set_in_progress(bg_req->module_name, bg_req->trace); + + /* - call before request hook */ + /* Get before request hook */ + LttvAttribute *module_attribute; + + g_assert(module_attribute = + LTTV_ATTRIBUTE(lttv_iattribute_find_subdir( + LTTV_IATTRIBUTE(g_attribute), + LTTV_COMPUTATION))); + + g_assert(module_attribute = + LTTV_ATTRIBUTE(lttv_iattribute_find_subdir( + LTTV_IATTRIBUTE(module_attribute), + bg_req->module_name))); + + type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(module_attribute), + LTTV_BEFORE_REQUEST, + &value); + g_assert(type == LTTV_POINTER); + LttvHooks *before_request = (LttvHooks*)*(value.v_pointer); + + + if(before_request != NULL) lttv_hooks_call(before_request, tsc); iter = g_slist_next(iter); } @@ -1064,6 +1106,27 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace) /* - set hooks'ready flag to TRUE */ lttvwindowtraces_set_ready(bg_req->module_name, bg_req->trace); + /* - call after request hook */ + /* Get after request hook */ + LttvAttribute *module_attribute; + + g_assert(module_attribute = + LTTV_ATTRIBUTE(lttv_iattribute_find_subdir( + LTTV_IATTRIBUTE(g_attribute), + LTTV_COMPUTATION))); + + g_assert(module_attribute = + LTTV_ATTRIBUTE(lttv_iattribute_find_subdir( + LTTV_IATTRIBUTE(module_attribute), + bg_req->module_name))); + + type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(module_attribute), + LTTV_AFTER_REQUEST, + &value); + g_assert(type == LTTV_POINTER); + LttvHooks *after_request = (LttvHooks*)*(value.v_pointer); + + if(after_request != NULL) lttv_hooks_call(after_request, tsc); /* - remove request */ remove = TRUE; free_data = TRUE; @@ -1354,6 +1417,7 @@ void lttvwindowtraces_unregister_computation_hooks { LttvAttribute *g_attribute = lttv_global_attributes(); LttvAttribute *attribute; + LttvAttributeValue value; g_assert(attribute = LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(g_attribute), @@ -1363,6 +1427,103 @@ void lttvwindowtraces_unregister_computation_hooks module_name))); + g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute), + LTTV_BEFORE_CHUNK_TRACESET, + LTTV_POINTER, + &value)); + LttvHooks *before_chunk_traceset = (LttvHooks*)*(value.v_pointer); + if(before_chunk_traceset != NULL) + lttv_hooks_destroy(before_chunk_traceset); + + g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute), + LTTV_BEFORE_CHUNK_TRACE, + LTTV_POINTER, + &value)); + LttvHooks *before_chunk_trace = (LttvHooks*)*(value.v_pointer); + if(before_chunk_trace != NULL) + lttv_hooks_destroy(before_chunk_trace); + + g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute), + LTTV_BEFORE_CHUNK_TRACEFILE, + LTTV_POINTER, + &value)); + LttvHooks *before_chunk_tracefile = (LttvHooks*)*(value.v_pointer); + if(before_chunk_tracefile != NULL) + lttv_hooks_destroy(before_chunk_tracefile); + + g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute), + LTTV_AFTER_CHUNK_TRACESET, + LTTV_POINTER, + &value)); + LttvHooks *after_chunk_traceset = (LttvHooks*)*(value.v_pointer); + if(after_chunk_traceset != NULL) + lttv_hooks_destroy(after_chunk_traceset); + + g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute), + LTTV_AFTER_CHUNK_TRACE, + LTTV_POINTER, + &value)); + LttvHooks *after_chunk_trace = (LttvHooks*)*(value.v_pointer); + if(after_chunk_trace != NULL) + lttv_hooks_destroy(after_chunk_trace); + + g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute), + LTTV_AFTER_CHUNK_TRACEFILE, + LTTV_POINTER, + &value)); + LttvHooks *after_chunk_tracefile = (LttvHooks*)*(value.v_pointer); + if(after_chunk_tracefile != NULL) + lttv_hooks_destroy(after_chunk_tracefile); + + g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute), + LTTV_BEFORE_REQUEST, + LTTV_POINTER, + &value)); + LttvHooks *before_request = (LttvHooks*)*(value.v_pointer); + if(before_request != NULL) + lttv_hooks_destroy(before_request); + + g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute), + LTTV_AFTER_REQUEST, + LTTV_POINTER, + &value)); + LttvHooks *after_request = (LttvHooks*)*(value.v_pointer); + if(after_request != NULL) + lttv_hooks_destroy(after_request); + + g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute), + LTTV_EVENT_HOOK, + LTTV_POINTER, + &value)); + LttvHooks *event_hook = (LttvHooks*)*(value.v_pointer); + if(event_hook != NULL) + lttv_hooks_destroy(event_hook); + + g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute), + LTTV_EVENT_HOOK_BY_ID, + LTTV_POINTER, + &value)); + LttvHooksById *event_hook_by_id = (LttvHooksById*)*(value.v_pointer); + if(event_hook_by_id != NULL) + lttv_hooks_by_id_destroy(event_hook_by_id); + + g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute), + LTTV_HOOK_ADDER, + LTTV_POINTER, + &value)); + LttvHooks *hook_adder = (LttvHooks*)*(value.v_pointer); + if(hook_adder != NULL) + lttv_hooks_destroy(hook_adder); + + g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute), + LTTV_HOOK_REMOVER, + LTTV_POINTER, + &value)); + LttvHooks *hook_remover = (LttvHooks*)*(value.v_pointer); + if(hook_remover != NULL) + lttv_hooks_destroy(hook_remover); + + lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(attribute), LTTV_EVENT_HOOK_BY_ID); lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(attribute),