From: compudj Date: Fri, 13 Aug 2004 20:43:32 +0000 (+0000) Subject: TimeWindow now has end_time X-Git-Tag: v0.12.20~2758 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6f26fc3843fad79c22e8dd745eff3d659b8eb550;p=lttv.git TimeWindow now has end_time git-svn-id: http://ltt.polymtl.ca/svn@731 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c index aaf8b030..f395d8ce 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c @@ -124,8 +124,7 @@ void drawing_data_request(Drawing_t *drawing, // G_OBJECT(drawing->drawing_area), "control_flow_data"); LttTime start, time_end; - LttTime window_end = ltt_time_add(time_window.time_width, - time_window.start_time); + LttTime window_end = time_window.end_time; g_debug("req : window start_time : %u, %u", time_window.start_time.tv_sec, time_window.start_time.tv_nsec); @@ -397,8 +396,8 @@ void drawing_data_request_begin(EventsRequest *events_request, LttvTracesetState LttvTracesetContext *tsc = LTTV_TRACESET_CONTEXT(tss); TimeWindow time_window = lttvwindow_get_time_window(cfd->tab); - LttTime end_time = ltt_time_add(time_window.start_time, - time_window.time_width); + LttTime end_time = time_window.end_time; + guint width = cfd->drawing->width; guint x=0; @@ -442,8 +441,8 @@ void drawing_request_expose(EventsRequest *events_request, g_debug("request expose"); - LttTime window_end = ltt_time_add(time_window.time_width, - time_window.start_time); + LttTime window_end = time_window.end_time; + #if 0 convert_time_to_pixels( time_window.start_time, @@ -594,9 +593,7 @@ expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer user_data ) guint cursor_x=0; - LttTime window_end = ltt_time_add(time_window.time_width, - time_window.start_time); - + LttTime window_end = time_window.end_time; /* update the screen from the pixmap buffer */ gdk_draw_pixmap(widget->window, @@ -694,8 +691,7 @@ button_press_event( GtkWidget *widget, GdkEventButton *event, gpointer user_data { LttTime time; - LttTime window_end = ltt_time_add(time_window.time_width, - time_window.start_time); + LttTime window_end = time_window.end_time; /* left mouse button click */ @@ -1166,9 +1162,7 @@ expose_ruler( GtkWidget *widget, GdkEventExpose *event, gpointer user_data ) GdkColor foreground = { 0, 0, 0, 0 }; GdkColor background = { 0, 0xffff, 0xffff, 0xffff }; - LttTime window_end = - ltt_time_add(time_window.time_width, - time_window.start_time); + LttTime window_end = time_window.end_time; LttTime half_width = ltt_time_div(time_window.time_width,2.0); LttTime window_middle = diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c index d3c454d2..197436ef 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c @@ -394,8 +394,7 @@ int before_schedchange_hook(void *hook_data, void *call_data) TimeWindow time_window = lttvwindow_get_time_window(control_flow_data->tab); - LttTime end_time = ltt_time_add(time_window.start_time, - time_window.time_width); + LttTime end_time = time_window.end_time; if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, end_time) == 1) @@ -687,8 +686,8 @@ int before_schedchange_hook(void *hook_data, void *call_data) TimeWindow time_window = lttvwindow_get_time_window(tab); - LttTime end_time = ltt_time_add(time_window.start_time, - time_window.time_width); + LttTime end_time = time_window.end_time; + //if(time < time_beg || time > time_end) return; if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, end_time) == 1) @@ -1308,8 +1307,7 @@ int after_schedchange_hook(void *hook_data, void *call_data) TimeWindow time_window = lttvwindow_get_time_window(control_flow_data->tab); - LttTime end_time = ltt_time_add(time_window.start_time, - time_window.time_width); + LttTime end_time = time_window.end_time; if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, end_time) == 1) @@ -1415,8 +1413,8 @@ int after_schedchange_hook(void *hook_data, void *call_data) TimeWindow time_window = lttvwindow_get_time_window(control_flow_data->tab); - LttTime end_time = ltt_time_add(time_window.start_time, - time_window.time_width); + LttTime end_time = time_window.end_time; + //if(time < time_beg || time > time_end) return; if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, end_time) == 1) @@ -1920,8 +1918,7 @@ int before_execmode_hook(void *hook_data, void *call_data) TimeWindow time_window = lttvwindow_get_time_window(control_flow_data->tab); - LttTime end_time = ltt_time_add(time_window.start_time, - time_window.time_width); + LttTime end_time = time_window.end_time; if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, end_time) == 1) @@ -2080,8 +2077,7 @@ int after_execmode_hook(void *hook_data, void *call_data) TimeWindow time_window = lttvwindow_get_time_window(control_flow_data->tab); - LttTime end_time = ltt_time_add(time_window.start_time, - time_window.time_width); + LttTime end_time = time_window.end_time; if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, end_time) == 1) @@ -2186,8 +2182,7 @@ int before_process_hook(void *hook_data, void *call_data) TimeWindow time_window = lttvwindow_get_time_window(control_flow_data->tab); - LttTime end_time = ltt_time_add(time_window.start_time, - time_window.time_width); + LttTime end_time = time_window.end_time; if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, end_time) == 1) @@ -2358,8 +2353,7 @@ int after_process_hook(void *hook_data, void *call_data) TimeWindow time_window = lttvwindow_get_time_window(control_flow_data->tab); - LttTime end_time = ltt_time_add(time_window.start_time, - time_window.time_width); + LttTime end_time = time_window.end_time; if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, end_time) == 1) @@ -2564,10 +2558,8 @@ gint update_time_window_hook(void *hook_data, void *call_data) g_info("scrolling"); LttTime *ns = &new_time_window->start_time; LttTime *os = &old_time_window->start_time; - LttTime old_end = ltt_time_add(old_time_window->start_time, - old_time_window->time_width); - LttTime new_end = ltt_time_add(new_time_window->start_time, - new_time_window->time_width); + LttTime old_end = old_time_window->end_time; + LttTime new_end = new_time_window->end_time; //if(nstab, new_time_window); } @@ -2903,6 +2896,7 @@ gint update_current_time_hook(void *hook_data, void *call_data) new_time_window.start_time = time_begin; new_time_window.time_width = width; + new_time_window.end_time = ltt_time_add(time_begin, width); lttvwindow_report_time_window(control_flow_data->tab, new_time_window); @@ -2940,8 +2934,7 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data) TimeWindow time_window = lttvwindow_get_time_window(control_flow_data->tab); - LttTime end_time = ltt_time_add(time_window.start_time, - time_window.time_width); + LttTime end_time = time_window.end_time; if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, end_time) == 1) 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 e0e677fc..e4c497d4 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -471,8 +471,7 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset) /* Set the tab's time window and current time if * out of bounds */ if(ltt_time_compare(tab->time_window.start_time, time_span.start_time) < 0 - || ltt_time_compare( ltt_time_add(tab->time_window.start_time, - tab->time_window.time_width), + || ltt_time_compare(tab->time_window.end_time, time_span.end_time) > 0) { new_time_window.start_time = time_span.start_time; @@ -486,6 +485,8 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset) tmp_time.tv_sec = time_span.end_time.tv_sec; tmp_time.tv_nsec = 0; new_time_window.time_width = tmp_time ; + new_time_window.end_time = ltt_time_add(new_time_window.start_time, + new_time_window.time_width) ; } time_change_manager(tab, new_time_window); current_time_change_manager(tab, new_current_time); @@ -2283,31 +2284,41 @@ void zoom(GtkWidget * widget, double size) if(size == 0){ new_time_window.start_time = time_span.start_time; new_time_window.time_width = time_delta; + new_time_window.end_time = ltt_time_add(new_time_window.start_time, + new_time_window.time_width) ; }else{ new_time_window.time_width = ltt_time_div(new_time_window.time_width, size); if(ltt_time_compare(new_time_window.time_width,time_delta) > 0) { /* Case where zoom out is bigger than trace length */ new_time_window.start_time = time_span.start_time; new_time_window.time_width = time_delta; + new_time_window.end_time = ltt_time_add(new_time_window.start_time, + new_time_window.time_width) ; } else { /* Center the image on the current time */ new_time_window.start_time = ltt_time_sub(current_time, ltt_time_div(new_time_window.time_width, 2.0)); + new_time_window.end_time = ltt_time_add(new_time_window.start_time, + new_time_window.time_width) ; /* If on borders, don't fall off */ if(ltt_time_compare(new_time_window.start_time, time_span.start_time) <0) { new_time_window.start_time = time_span.start_time; + new_time_window.end_time = ltt_time_add(new_time_window.start_time, + new_time_window.time_width) ; } else { - if(ltt_time_compare( - ltt_time_add(new_time_window.start_time, new_time_window.time_width), - time_span.end_time) > 0) + if(ltt_time_compare(new_time_window.end_time, + time_span.end_time) > 0) { new_time_window.start_time = ltt_time_sub(time_span.end_time, new_time_window.time_width); + + new_time_window.end_time = ltt_time_add(new_time_window.start_time, + new_time_window.time_width) ; } } @@ -3432,8 +3443,7 @@ void time_change_manager (Tab *tab, LttvTracesetContext *tsc = LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); TimeInterval time_span = tsc->time_span; LttTime start_time = new_time_window.start_time; - LttTime end_time = ltt_time_add(new_time_window.start_time, - new_time_window.time_width); + LttTime end_time = new_time_window.end_time; /* Set scrollbar */ GtkAdjustment *adjustment = gtk_range_get_adjustment(GTK_RANGE(tab->scrollbar)); @@ -3567,8 +3577,7 @@ on_MEntry1_value_changed (GtkSpinButton *spinbutton, TimeWindow new_time_window = tab->time_window; - LttTime end_time = ltt_time_add(new_time_window.start_time, - new_time_window.time_width); + LttTime end_time = new_time_window.end_time; new_time_window.start_time.tv_sec = value; @@ -3589,19 +3598,18 @@ on_MEntry1_value_changed (GtkSpinButton *spinbutton, new_time_window.start_time.tv_nsec = time_span.end_time.tv_nsec-1; } - /* check if end time selected is below or equal */ if(ltt_time_compare(new_time_window.start_time, end_time) >= 0) { /* Then, we must push back end time : keep the same time width * if possible, else end traceset time */ - end_time = LTT_TIME_MIN(time_span.end_time, - ltt_time_add(new_time_window.start_time, - new_time_window.time_width) - ); + end_time = LTT_TIME_MIN(ltt_time_add(new_time_window.start_time, + new_time_window.time_width), + time_span.end_time); } /* Fix the time width to fit start time and end time */ new_time_window.time_width = ltt_time_sub(end_time, new_time_window.start_time); + new_time_window.end_time = end_time; time_change_manager(tab, new_time_window); @@ -3619,25 +3627,24 @@ on_MEntry2_value_changed (GtkSpinButton *spinbutton, TimeWindow new_time_window = tab->time_window; - LttTime end_time = ltt_time_add(new_time_window.start_time, - new_time_window.time_width); + LttTime end_time = new_time_window.end_time; new_time_window.start_time.tv_nsec = value; - /* check if end time selected is below or equal */ if(ltt_time_compare(new_time_window.start_time, end_time) >= 0) { /* Then, we must push back end time : keep the same time width * if possible, else end traceset time */ - end_time = LTT_TIME_MIN(time_span.end_time, - ltt_time_add(new_time_window.start_time, - new_time_window.time_width) - ); + end_time = LTT_TIME_MIN(ltt_time_add(new_time_window.start_time, + new_time_window.time_width), + time_span.end_time); } /* Fix the time width to fit start time and end time */ new_time_window.time_width = ltt_time_sub(end_time, new_time_window.start_time); + new_time_window.end_time = end_time; + time_change_manager(tab, new_time_window); } @@ -3654,8 +3661,8 @@ on_MEntry3_value_changed (GtkSpinButton *spinbutton, TimeWindow new_time_window = tab->time_window; - LttTime end_time = ltt_time_add(new_time_window.start_time, - new_time_window.time_width); + LttTime end_time = new_time_window.end_time; + end_time.tv_sec = value; /* end nanoseconds */ @@ -3675,20 +3682,21 @@ on_MEntry3_value_changed (GtkSpinButton *spinbutton, end_time.tv_nsec = time_span.end_time.tv_nsec; } - /* check if end time selected is below or equal */ if(ltt_time_compare(new_time_window.start_time, end_time) >= 0) { /* Then, we must push front start time : keep the same time width * if possible, else end traceset time */ - new_time_window.start_time = LTT_TIME_MAX(time_span.start_time, - ltt_time_sub(end_time, - new_time_window.time_width) - ); + new_time_window.start_time = LTT_TIME_MAX( + ltt_time_sub(end_time, + new_time_window.time_width), + time_span.start_time); } /* Fix the time width to fit start time and end time */ new_time_window.time_width = ltt_time_sub(end_time, new_time_window.start_time); + new_time_window.end_time = end_time; + time_change_manager(tab, new_time_window); } @@ -3705,23 +3713,23 @@ on_MEntry4_value_changed (GtkSpinButton *spinbutton, TimeWindow new_time_window = tab->time_window; - LttTime end_time = ltt_time_add(new_time_window.start_time, - new_time_window.time_width); + LttTime end_time = new_time_window.end_time; + end_time.tv_nsec = value; - /* check if end time selected is below or equal */ if(ltt_time_compare(new_time_window.start_time, end_time) >= 0) { /* Then, we must push front start time : keep the same time width * if possible, else end traceset time */ - new_time_window.start_time = LTT_TIME_MAX(time_span.start_time, - ltt_time_sub(end_time, - new_time_window.time_width) - ); + new_time_window.start_time = LTT_TIME_MAX( + ltt_time_sub(end_time, + new_time_window.time_width), + time_span.start_time); } /* Fix the time width to fit start time and end time */ new_time_window.time_width = ltt_time_sub(end_time, new_time_window.start_time); + new_time_window.end_time = end_time; time_change_manager(tab, new_time_window); @@ -3847,6 +3855,9 @@ void scroll_value_changed_cb(GtkWidget *scrollbar, new_time_window.time_width = ltt_time_from_double(page_size); + new_time_window.end_time = ltt_time_add(new_time_window.start_time, + new_time_window.time_width); + time_change_manager(tab, new_time_window); #if 0 diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/mainwindow.h b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/mainwindow.h index d46969b2..5dcc85ff 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/mainwindow.h +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/mainwindow.h @@ -30,6 +30,7 @@ typedef struct _TracesetInfo TracesetInfo; struct _TimeWindow { LttTime start_time; LttTime time_width; + LttTime end_time; };