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,
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;
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;
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
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
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;
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
+
+
+
}
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;
}
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) ;
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;
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;
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;
*/
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;
*/
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;