X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmodules%2Fgui%2Fcontrolflow%2Fdrawing.c;h=265c68d5563d8461c1f10946523a75d683e8aaf2;hb=4e86ae2e22548733054ffe05644d4a66030c859e;hp=28934be2dc5f27b271f668e6d451bb903ed1b851;hpb=f16a5569e0071a47d2f658225045e8c75de1a7c6;p=lttv.git diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c index 28934be2..265c68d5 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c @@ -36,7 +36,7 @@ //FIXME #define TRACE_NUMBER 0 - +#if 0 /* colors for two lines representation */ GdkColor drawing_colors[NUM_COLORS] = { /* Pixel, R, G, B */ { 0, 0, 0, 0 }, /* COL_BLACK */ @@ -54,6 +54,27 @@ GdkColor drawing_colors[NUM_COLORS] = { 0, 0xFFFF, 0xFFFF, 0xFFFF } /* COL_MODE_UNKNOWN : white */ }; +#endif //0 + + +GdkColor drawing_colors[NUM_COLORS] = +{ /* Pixel, R, G, B */ + { 0, 0, 0, 0 }, /* COL_BLACK */ + { 0, 0xFFFF, 0xFFFF, 0xFFFF }, /* COL_WHITE */ + { 0, 0x0000, 0xFF00, 0x0000 }, /* COL_RUN_USER_MODE : green */ + { 0, 0x0100, 0x9E00, 0xFFFF }, /* COL_RUN_SYSCALL : pale blue */ + { 0, 0xFF00, 0xFF00, 0x0100 }, /* COL_RUN_TRAP : yellow */ + { 0, 0xFFFF, 0x0000, 0x0000 }, /* COL_RUN_IRQ : red */ + { 0, 0xA3FF, 0x0000, 0x0000 }, /* COL_WAIT : dark red */ + { 0, 0x7700, 0x7700, 0x0000 }, /* COL_WAIT_CPU : dark yellow */ + { 0, 0x6400, 0x0000, 0x5D00 }, /* COL_ZOMBIE : dark purple */ + { 0, 0x0700, 0x6400, 0x0000 }, /* COL_WAIT_FORK : dark green */ + { 0, 0x8900, 0x0000, 0x8400 }, /* COL_EXIT : "less dark" magenta */ + { 0, 0xFFFF, 0xFFFF, 0xFFFF }, /* COL_MODE_UNKNOWN : white */ + { 0, 0xFFFF, 0xFFFF, 0xFFFF } /* COL_UNNAMED : white */ + +}; + /* RUN+USER MODE green RUN+SYSCALL @@ -94,12 +115,6 @@ void drawing_data_request(Drawing_t *drawing, if(width < 0) return ; if(height < 0) return ; - if(drawing->gc == NULL) { - drawing->gc = gdk_gc_new(drawing->drawing_area->window); - gdk_gc_copy(drawing->gc, drawing->drawing_area->style->black_gc); - } - - Tab *tab = drawing->control_flow_data->tab; TimeWindow time_window = lttvwindow_get_time_window(tab); @@ -109,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); @@ -124,13 +138,11 @@ void drawing_data_request(Drawing_t *drawing, g_debug("x is : %i, x+width is : %i", x, x+width); convert_pixels_to_time(drawing->width, x, - time_window.start_time, - window_end, + time_window, &start); convert_pixels_to_time(drawing->width, x+width, - time_window.start_time, - window_end, + time_window, &time_end); lttvwindow_events_request_remove_all(tab, @@ -157,8 +169,7 @@ void drawing_data_request(Drawing_t *drawing, nb_trace = lttv_traceset_number(traceset); // FIXME : eventually request for more traces // for(i = 0 ; i < nb_trace ; i++) { - g_assert(TRACE_NUMBER < nb_trace); - i = TRACE_NUMBER; + for(i = 0; ix.over = x; + hashed_process_data->x.over_used = FALSE; + hashed_process_data->x.over_marked = FALSE; hashed_process_data->x.middle = x; + hashed_process_data->x.middle_used = FALSE; + hashed_process_data->x.middle_marked = FALSE; hashed_process_data->x.under = x; + hashed_process_data->x.under_used = FALSE; + hashed_process_data->x.under_marked = FALSE; + hashed_process_data->next_good_time = ltt_time_zero; return; } @@ -377,22 +395,25 @@ 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; cfd->drawing->last_start = events_request->start_time; convert_time_to_pixels( - time_window.start_time, - end_time, + time_window, events_request->start_time, width, &x); g_hash_table_foreach(cfd->process_list->process_hash, set_last_start, (gpointer)x); + + cfd->process_list->current_process_info = NULL; + cfd->process_list->current_hash_data = NULL; + } void drawing_chunk_begin(EventsRequest *events_request, LttvTracesetState *tss) @@ -422,20 +443,18 @@ 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, - window_end, + time_window, cfd->drawing->last_start, drawing->width, &x); #endif //0 convert_time_to_pixels( - time_window.start_time, - window_end, + time_window, end_time, drawing->width, &x_end); @@ -562,6 +581,10 @@ expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer user_data ) (ControlFlowData*)g_object_get_data( G_OBJECT(widget), "control_flow_data"); + if(drawing->gc == NULL) { + drawing->gc = gdk_gc_new(drawing->drawing_area->window); + gdk_gc_copy(drawing->gc, drawing->drawing_area->style->black_gc); + } TimeWindow time_window = lttvwindow_get_time_window(control_flow_data->tab); @@ -570,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, @@ -588,8 +609,7 @@ expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer user_data ) { /* Draw the dotted lines */ convert_time_to_pixels( - time_window.start_time, - window_end, + time_window, current_time, drawing->width, &cursor_x); @@ -670,16 +690,14 @@ 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 */ g_debug("x click is : %f", event->x); convert_pixels_to_time(drawing->width, (guint)event->x, - time_window.start_time, - window_end, + time_window, &time); lttvwindow_report_current_time(control_flow_data->tab, time); @@ -860,10 +878,9 @@ Drawing_t *drawing_construct(ControlFlowData *control_flow_data) /* Allocate the colors */ GdkColormap* colormap = gdk_colormap_get_system(); - + gboolean success[NUM_COLORS]; gdk_colormap_alloc_colors(colormap, drawing_colors, NUM_COLORS, FALSE, - TRUE, NULL); - + TRUE, success); return drawing; } @@ -907,43 +924,40 @@ GtkWidget *drawing_get_widget(Drawing_t *drawing) __inline void convert_pixels_to_time( gint width, guint x, - LttTime window_time_begin, - LttTime window_time_end, + TimeWindow time_window, LttTime *time) { - LttTime window_time_interval; - guint64 time_ll; + double time_d; - window_time_interval = ltt_time_sub(window_time_end, - window_time_begin); - time_ll = ltt_time_to_uint64(window_time_interval); - time_ll = time_ll * x / width; - *time = ltt_time_from_uint64(time_ll); - *time = ltt_time_add(window_time_begin, *time); + time_d = time_window.time_width_double; + time_d = time_d / (double)width * (double)x; + *time = ltt_time_from_double(time_d); + *time = ltt_time_add(time_window.start_time, *time); } __inline void convert_time_to_pixels( - LttTime window_time_begin, - LttTime window_time_end, + TimeWindow time_window, LttTime time, int width, guint *x) { - LttTime window_time_interval; - guint64 time_ll, interval_ll; - + double time_d; +#ifdef EXTRA_CHECK g_assert(ltt_time_compare(window_time_begin, time) <= 0 && ltt_time_compare(window_time_end, time) >= 0); +#endif //EXTRA_CHECK - window_time_interval = ltt_time_sub(window_time_end,window_time_begin); + time = ltt_time_sub(time, time_window.start_time); - time = ltt_time_sub(time, window_time_begin); + time_d = ltt_time_to_double(time); - time_ll = ltt_time_to_uint64(time); - interval_ll = ltt_time_to_uint64(window_time_interval); - - *x = (guint)(time_ll * width / interval_ll); + if(time_window.time_width_double == 0.0) { + g_assert(time_d == 0.0); + *x = 0; + } else { + *x = (guint)(time_d / time_window.time_width_double * (double)width); + } } @@ -1138,9 +1152,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 =