From: compudj Date: Thu, 5 Aug 2004 00:56:06 +0000 (+0000) Subject: make precision correct when calling conversion between LttTime and double, fix viewer... X-Git-Tag: v0.12.20~2826 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=0c5dbe3b7a45055b7ed07cd497b51801b3e8310e;p=lttv.git make precision correct when calling conversion between LttTime and double, fix viewer precision problems found git-svn-id: http://ltt.polymtl.ca/svn@663 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/doc/developer/lttvwindow_events_delivery.txt b/ltt/branches/poly/doc/developer/lttvwindow_events_delivery.txt index a3a785f5..c52b6a3a 100644 --- a/ltt/branches/poly/doc/developer/lttvwindow_events_delivery.txt +++ b/ltt/branches/poly/doc/developer/lttvwindow_events_delivery.txt @@ -308,7 +308,10 @@ list_in : empty list_out : many events requests -A. While (list_in !empty or list_out !empty) and !GTK Event pending +0.1 Lock the traces +0.2 Seek traces positions to current context position. + +A. While (list_in !empty or list_out !empty) 1. If list_in is empty (need a seek) 1.1 Add requests to list_in 1.1.1 Find all time requests with lowest start time in list_out (ltime) @@ -331,6 +334,9 @@ A. While (list_in !empty or list_out !empty) and !GTK Event pending 1.3.2 call before chunk 1.3.3 events hooks added 2. Else, list_in is not empty, we continue a read + 2.0 For each req of list_in + - Call before chunk + - events hooks added 2.1 For each req of list_out - if req.start time == current context time or req.start position == current position @@ -372,13 +378,14 @@ A. While (list_in !empty or list_out !empty) and !GTK Event pending - req.num -= count - if req.num == 0 or - current context time > req.end time + current context time >= req.end time or req.end pos == current pos or req.stop_flag == TRUE - Call end request for req - remove req from list_in + If GTK Event pending : break A loop B. When interrupted between chunks 1. for each request in list_in @@ -386,6 +393,8 @@ B. When interrupted between chunks 1.2. Remove start time 1.3. Move from list_in to list_out +C. Unlock the traces + Notes : diff --git a/ltt/branches/poly/doc/developer/requests_servicing_schedulers.txt b/ltt/branches/poly/doc/developer/requests_servicing_schedulers.txt index 6919923b..beaca699 100644 --- a/ltt/branches/poly/doc/developer/requests_servicing_schedulers.txt +++ b/ltt/branches/poly/doc/developer/requests_servicing_schedulers.txt @@ -219,11 +219,19 @@ computation/ /* Global background computation hooks */ after_request event_hook event_hook_by_id + hook_adder + hook_remover stats/ ... modulename1/ ... +Hook Adder and Hook remover + +Hook functions that takes a trace context as call data. They simply +add / remove the computation related hooks from the trace context. + + Modify Traceset Points to the global traces. Main window must open a new one only when no @@ -270,16 +278,20 @@ notify_in : currently checked notifications notify_out : queue of notifications that comes along with next processing. +0.1 Lock traces +0.2 Sync tracefiles + 1. Before processing - if list_in is empty - Add all requests in list_out to list_in, empty list_out - for each request in list_in - set hooks'in_progress flag to TRUE + - call before request hook - seek trace to start - Move all notifications from notify_out to notify_in. - for each request in list_in - Call before chunk hooks for list_in - - add hooks to context + - add hooks to context *note only one hook of each type added. 2. call process traceset middle for a chunk (assert list_in is not empty! : should not even be called in that case) @@ -288,7 +300,7 @@ notify_out : queue of notifications that comes along with next processing. 3.1 call after_chunk hooks for list_in - for each request in list_in - Call after chunk hooks for list_in - - remove hooks from context + - remove hooks from context *note : only one hook of each type 3.2 for each notify_in - if current time >= notify time, call notify and remove from notify_in - if current position >= notify position, call notify and remove from @@ -297,10 +309,16 @@ notify_out : queue of notifications that comes along with next processing. - for each request in list_in - set hooks'in_progress flag to FALSE - set hooks'ready flag to TRUE + - call after request hook - remove request - for each notifications in notify_in - call notify and remove from notify_in - - return FALSE (scheduler stopped) + - reset the context + - if list_out is empty + return FALSE (scheduler stopped) + - else + return TRUE (scheduler still registered) 3.4 else - return TRUE (scheduler still registered) +4. Unlock traces diff --git a/ltt/branches/poly/ltt/time.h b/ltt/branches/poly/ltt/time.h index a095895a..d961f373 100644 --- a/ltt/branches/poly/ltt/time.h +++ b/ltt/branches/poly/ltt/time.h @@ -121,6 +121,7 @@ static inline double ltt_time_to_double(LttTime t1) * * So we have 53-30 = 23 bits left for tv_sec. * */ + g_assert(t1.tv_sec <= MAX_TV_SEC_TO_DOUBLE); if(t1.tv_sec > MAX_TV_SEC_TO_DOUBLE) g_warning("Precision loss in conversion LttTime to double"); return (double)t1.tv_sec + (double)t1.tv_nsec / NANOSECONDS_PER_SECOND; @@ -137,6 +138,7 @@ static inline LttTime ltt_time_from_double(double t1) * * So we have 53-30 = 23 bits left for tv_sec. * */ + g_assert(t1 <= MAX_TV_SEC_TO_DOUBLE); if(t1 > MAX_TV_SEC_TO_DOUBLE) g_warning("Conversion from non precise double to LttTime"); LttTime res; diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c index d9d4a03d..2cd92c2e 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c @@ -402,14 +402,7 @@ expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer user_data ) LttTime window_end = ltt_time_add(time_window.time_width, time_window.start_time); - convert_time_to_pixels( - time_window.start_time, - window_end, - current_time, - drawing->width, - &cursor_x); - /* update the screen from the pixmap buffer */ gdk_draw_pixmap(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE (widget)], @@ -418,30 +411,41 @@ expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer user_data ) event->area.x, event->area.y, event->area.width, event->area.height); + + if(ltt_time_compare(time_window.start_time, current_time) <= 0 && + ltt_time_compare(window_end, current_time) >= 0) + { + /* Draw the dotted lines */ + convert_time_to_pixels( + time_window.start_time, + window_end, + current_time, + drawing->width, + &cursor_x); + - /* Draw the dotted lines */ + if(drawing->dotted_gc == NULL) { - if(drawing->dotted_gc == NULL) { + drawing->dotted_gc = gdk_gc_new(drawing->drawing_area->window); + gdk_gc_copy(drawing->dotted_gc, widget->style->white_gc); + + gint8 dash_list[] = { 1, 2 }; + gdk_gc_set_line_attributes(drawing->dotted_gc, + 1, + GDK_LINE_ON_OFF_DASH, + GDK_CAP_BUTT, + GDK_JOIN_MITER); + gdk_gc_set_dashes(drawing->dotted_gc, + 0, + dash_list, + 2); + } - drawing->dotted_gc = gdk_gc_new(drawing->drawing_area->window); - gdk_gc_copy(drawing->dotted_gc, widget->style->white_gc); - - gint8 dash_list[] = { 1, 2 }; - gdk_gc_set_line_attributes(drawing->dotted_gc, - 1, - GDK_LINE_ON_OFF_DASH, - GDK_CAP_BUTT, - GDK_JOIN_MITER); - gdk_gc_set_dashes(drawing->dotted_gc, - 0, - dash_list, - 2); + drawing_draw_line(NULL, widget->window, + cursor_x, 0, + cursor_x, drawing->height, + drawing->dotted_gc); } - - drawing_draw_line(NULL, widget->window, - cursor_x, 0, - cursor_x, drawing->height, - drawing->dotted_gc); return FALSE; } @@ -728,6 +732,9 @@ void convert_time_to_pixels( LttTime window_time_interval; double interval_double, time_double; + g_assert(ltt_time_compare(window_time_begin, time) <= 0 && + ltt_time_compare(window_time_end, time) >= 0); + window_time_interval = ltt_time_sub(window_time_end,window_time_begin); time = ltt_time_sub(time, window_time_begin); diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c index cb1121ac..19d004b9 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c @@ -2277,11 +2277,12 @@ int after_chunk(void *hook_data, void *call_data) ProcessList *process_list = guicontrolflow_get_process_list(control_flow_data); - if(tfc != NULL) + if(tfc != NULL + && ltt_time_compare(tfc->timestamp, events_request->end_time) <= 0) end_time = tfc->timestamp; - else /* end of traceset */ - end_time = tsc->time_span.end_time; - + else /* end of traceset, or position now out of request : end */ + end_time = events_request->end_time; + ClosureData closure_data; closure_data.events_request = (EventsRequest*)hook_data; closure_data.tss = tss; diff --git a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c index ee6e6c52..1588c5f5 100644 --- a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c +++ b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c @@ -1511,7 +1511,7 @@ gboolean update_current_time(void * hook_data, void * call_data) sprintf(str_path,"%d\0",count); path = gtk_tree_path_new_from_string (str_path); gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE); - g_signal_stop_emission_by_name(G_OBJECT(event_viewer_data->tree_v), "cursor-changed"); + //g_signal_stop_emission_by_name(G_OBJECT(event_viewer_data->tree_v), "cursor-changed"); gtk_tree_path_free(path); return FALSE; 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 41b0a0fc..297b2a3b 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -256,13 +256,13 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset) LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); TimeInterval time_span = tsc->time_span; GtkAdjustment *adjustment = gtk_range_get_adjustment(GTK_RANGE(tab->scrollbar)); + LttTime upper = ltt_time_sub(time_span.end_time, time_span.start_time); g_object_set(G_OBJECT(adjustment), "lower", - 0, /* lower */ + 0.0, /* lower */ "upper", - ltt_time_to_double( - ltt_time_sub(time_span.end_time, time_span.start_time)) + ltt_time_to_double(upper) * NANOSECONDS_PER_SECOND, /* upper */ "step_increment", ltt_time_to_double(tab->time_window.time_width) @@ -1996,15 +1996,15 @@ void zoom(GtkWidget * widget, double size) // // + LttTime rel_time = + ltt_time_sub(new_time_window.start_time, time_span.start_time); if( ltt_time_to_double(new_time_window.time_width) * NANOSECONDS_PER_SECOND / SCROLL_STEP_PER_PAGE/* step increment */ + - ltt_time_to_double(new_time_window.start_time) - * NANOSECONDS_PER_SECOND /* page size */ + ltt_time_to_double(rel_time) * NANOSECONDS_PER_SECOND /* page size */ == - ltt_time_to_double(new_time_window.start_time) - * NANOSECONDS_PER_SECOND /* page size */ + ltt_time_to_double(rel_time) * NANOSECONDS_PER_SECOND /* page size */ ) { g_warning("Can not zoom that far due to scrollbar precision"); } else if( @@ -2024,7 +2024,7 @@ void zoom(GtkWidget * widget, double size) //ltt_time_to_double(new_time_window.start_time) // * NANOSECONDS_PER_SECOND, /* value */ "lower", - 0, /* lower */ + 0.0, /* lower */ "upper", ltt_time_to_double( ltt_time_sub(time_span.end_time, time_span.start_time)) diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c index 8b1f2b21..076045bf 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c @@ -691,7 +691,7 @@ void lttvwindow_report_time_window(Tab *tab, g_object_set(G_OBJECT(adjustment), "lower", - 0, /* lower */ + 0.0, /* lower */ "upper", ltt_time_to_double( ltt_time_sub(time_span.end_time, time_span.start_time)) diff --git a/ltt/branches/poly/lttv/modules/text/textDump.c b/ltt/branches/poly/lttv/modules/text/textDump.c index 51e6994a..898c9b26 100644 --- a/ltt/branches/poly/lttv/modules/text/textDump.c +++ b/ltt/branches/poly/lttv/modules/text/textDump.c @@ -422,8 +422,5 @@ static void destroy() LTTV_MODULE("textDump", "Print events in a file", \ "Produce a detailed text printout of a trace", \ - init, destroy, "stats", "batchAnalysis") - - - + init, destroy, "stats", "batchAnalysis", "option")