From e7f5e89d1b5a36b99c24b738f446923a72966b3c Mon Sep 17 00:00:00 2001 From: compudj Date: Thu, 25 Aug 2005 17:06:21 +0000 Subject: [PATCH] control flow view works (state computation disabled) git-svn-id: http://ltt.polymtl.ca/svn@1076 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/lttv/lttv/state.c | 9 +-- ltt/branches/poly/lttv/lttv/tracecontext.c | 61 ++++++++++++++++--- .../lttv/modules/gui/controlflow/eventhooks.c | 7 +-- 3 files changed, 59 insertions(+), 18 deletions(-) diff --git a/ltt/branches/poly/lttv/lttv/state.c b/ltt/branches/poly/lttv/lttv/state.c index 0a7d13d5..6ee5e32e 100644 --- a/ltt/branches/poly/lttv/lttv/state.c +++ b/ltt/branches/poly/lttv/lttv/state.c @@ -488,6 +488,9 @@ static void state_restore(LttvTraceState *self, LttvAttribute *container) nb_tracefile = self->parent.tracefiles->len; + g_tree_destroy(tsc->pqueue); + tsc->pqueue = g_tree_new(compare_tracefile); + for(i = 0 ; i < nb_tracefile ; i++) { tfcs = LTTV_TRACEFILE_STATE(g_array_index(self->parent.tracefiles, @@ -505,18 +508,16 @@ static void state_restore(LttvTraceState *self, LttvAttribute *container) type = lttv_attribute_get_by_name(tracefile_tree, LTTV_STATE_EVENT, &value); g_assert(type == LTTV_POINTER); - g_assert(*(value.v_pointer) != NULL); + //g_assert(*(value.v_pointer) != NULL); ep = *(value.v_pointer); g_assert(tfcs->parent.t_context != NULL); - g_tree_destroy(tsc->pqueue); - tsc->pqueue = g_tree_new(compare_tracefile); - LttvTracefileContext *tfc = LTTV_TRACEFILE_CONTEXT(tfcs); if(ep != NULL) { g_assert(ltt_tracefile_seek_position(tfc->tf, ep) == 0); tfc->timestamp = ltt_event_time(ltt_tracefile_get_event(tfc->tf)); + g_assert(ltt_time_compare(tfc->timestamp, ltt_time_infinite) != 0); g_tree_insert(tsc->pqueue, tfc, tfc); } else { tfc->timestamp = ltt_time_infinite; diff --git a/ltt/branches/poly/lttv/lttv/tracecontext.c b/ltt/branches/poly/lttv/lttv/tracecontext.c index 69b2e14f..fca7dacc 100644 --- a/ltt/branches/poly/lttv/lttv/tracecontext.c +++ b/ltt/branches/poly/lttv/lttv/tracecontext.c @@ -623,6 +623,10 @@ static gboolean get_first(gpointer key, gpointer value, gpointer user_data) { return TRUE; } +#ifdef DEBUG +// Test to see if pqueue is traversed in the right order. +static LttTime test_time; + static gboolean test_tree(gpointer key, gpointer value, gpointer user_data) { LttvTracefileContext *tfc = (LttvTracefileContext *)key; @@ -631,15 +635,22 @@ static gboolean test_tree(gpointer key, gpointer value, gpointer user_data) { g_quark_to_string(ltt_tracefile_name(tfc->tf)), tfc->timestamp.tv_sec, tfc->timestamp.tv_nsec, tfc->index, tfc->t_context->index); + + if(user_data != NULL) { + if(((LttvTracefileContext *)user_data) == (LttvTracefileContext *)value) { + g_assert(compare_tracefile(user_data, value) == 0); + } else + g_assert(compare_tracefile(user_data, value) != 0); + } + g_assert(ltt_time_compare(test_time, tfc->timestamp) <= 0); + test_time.tv_sec = tfc->timestamp.tv_sec; + test_time.tv_nsec = tfc->timestamp.tv_nsec; - if(((LttvTracefileContext *)user_data) == (LttvTracefileContext *)value) { - g_assert(compare_tracefile(user_data, value) == 0); - } else - g_assert(compare_tracefile(user_data, value) != 0); //g_assert(((LttvTracefileContext *)user_data) != (LttvTracefileContext *)value); return FALSE; } +#endif //DEBUG @@ -722,12 +733,16 @@ guint lttv_process_traceset_middle(LttvTracesetContext *self, and remove are consistent. */ #ifdef DEBUG + test_time.tv_sec = 0; + test_time.tv_nsec = 0; g_debug("test tree before remove"); g_tree_foreach(pqueue, test_tree, tfc); #endif //DEBUG g_tree_remove(pqueue, tfc); #ifdef DEBUG + test_time.tv_sec = 0; + test_time.tv_nsec = 0; g_debug("test tree after remove"); g_tree_foreach(pqueue, test_tree, tfc); #endif //DEBUG @@ -751,8 +766,15 @@ guint lttv_process_traceset_middle(LttvTracesetContext *self, if(likely(!read_ret)) { g_debug("An event is ready"); tfc->timestamp = ltt_event_time(e); - + g_assert(ltt_time_compare(tfc->timestamp, ltt_time_infinite) != 0); g_tree_insert(pqueue, tfc, tfc); +#ifdef DEBUG + test_time.tv_sec = 0; + test_time.tv_nsec = 0; + g_debug("test tree after event ready"); + g_tree_foreach(pqueue, test_tree, NULL); +#endif //DEBUG + last_read_state = LAST_OK; } else { tfc->timestamp = ltt_time_infinite; @@ -795,25 +817,38 @@ void lttv_process_trace_seek_time(LttvTraceContext *self, LttTime start) LttvTracefileContext **tfc; - GTree *pqueue = self->ts_context->pqueue; - nb_tracefile = self->tracefiles->len; + g_tree_destroy(self->ts_context->pqueue); + self->ts_context->pqueue = g_tree_new(compare_tracefile); + + GTree *pqueue = self->ts_context->pqueue; + for(i = 0 ; i < nb_tracefile ; i++) { tfc = &g_array_index(self->tracefiles, LttvTracefileContext*, i); - g_tree_remove(pqueue, *tfc); + //g_tree_remove(pqueue, *tfc); ret = ltt_tracefile_seek_time((*tfc)->tf, start); if(ret == EPERM) g_error("error in lttv_process_trace_seek_time seek"); if(ret == 0) { /* not ERANGE especially */ (*tfc)->timestamp = ltt_event_time(ltt_tracefile_get_event((*tfc)->tf)); + g_assert(ltt_time_compare((*tfc)->timestamp, ltt_time_infinite) != 0); g_tree_insert(pqueue, (*tfc), (*tfc)); } else { (*tfc)->timestamp = ltt_time_infinite; } } +#ifdef DEBUG + test_time.tv_sec = 0; + test_time.tv_nsec = 0; + g_debug("test tree after seek_time"); + g_tree_foreach(pqueue, test_tree, NULL); +#endif //DEBUG + + + } @@ -849,12 +884,22 @@ gboolean lttv_process_traceset_seek_position(LttvTracesetContext *self, if(ltt_tracefile_seek_position((*tfc)->tf, *ep) != 0) return 1; (*tfc)->timestamp = ltt_event_time(ltt_tracefile_get_event((*tfc)->tf)); + g_assert(ltt_time_compare((*tfc)->timestamp, ltt_time_infinite) != 0); g_tree_insert(self->pqueue, (*tfc), (*tfc)); } else { (*tfc)->timestamp = ltt_time_infinite; } } } +#ifdef DEBUG + test_time.tv_sec = 0; + test_time.tv_nsec = 0; + g_debug("test tree after seek_position"); + g_tree_foreach(self->pqueue, test_tree, NULL); +#endif //DEBUG + + + return 0; } diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c index a322c5d5..e5b66cc9 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c @@ -256,7 +256,7 @@ h_guicontrolflow(Tab *tab) lttvwindow_register_continue_notify(tab, continue_notify, control_flow_data); - request_background_data(control_flow_data); + //request_background_data(control_flow_data); return guicontrolflow_get_widget(control_flow_data) ; @@ -1952,7 +1952,6 @@ static inline PropertiesLine prepare_execmode_line(LttvProcessState *process) int before_execmode_hook(void *hook_data, void *call_data) { - return 0; //DISABLED LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data; EventsRequest *events_request = (EventsRequest*)thf->hook_data; ControlFlowData *control_flow_data = events_request->viewer_data; @@ -2260,7 +2259,6 @@ int after_execmode_hook(void *hook_data, void *call_data) int before_process_exit_hook(void *hook_data, void *call_data) { - return 0; //DISABLED LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data; EventsRequest *events_request = (EventsRequest*)thf->hook_data; @@ -2447,7 +2445,6 @@ int before_process_exit_hook(void *hook_data, void *call_data) int before_process_release_hook(void *hook_data, void *call_data) { - return 0; //DISABLED LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data; EventsRequest *events_request = (EventsRequest*)thf->hook_data; @@ -3004,7 +3001,6 @@ int before_process_hook(void *hook_data, void *call_data) */ int after_process_fork_hook(void *hook_data, void *call_data) { - return 0; //DISABLED LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data; EventsRequest *events_request = (EventsRequest*)thf->hook_data; ControlFlowData *control_flow_data = events_request->viewer_data; @@ -3124,7 +3120,6 @@ int after_process_fork_hook(void *hook_data, void *call_data) */ int after_process_exit_hook(void *hook_data, void *call_data) { - return 0; //DISABLED LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data; EventsRequest *events_request = (EventsRequest*)thf->hook_data; ControlFlowData *control_flow_data = events_request->viewer_data; -- 2.34.1