accelerate double useage for time
[lttv.git] / ltt / branches / poly / lttv / modules / gui / controlflow / drawing.c
index 18407dd8fe38e8f84671eb611e8edee877a766da..aaf8b03005d0b47d0ac6600a745db1ef50f717c9 100644 (file)
@@ -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);
@@ -157,8 +172,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; i<MIN(TRACE_NUMBER+1, nb_trace);i++)
     {
       EventsRequest *events_request = g_new(EventsRequest, 1);
       // Create the hooks
@@ -364,8 +378,14 @@ static void set_last_start(gpointer key, gpointer value, gpointer user_data)
   guint x = (guint)user_data;
 
   hashed_process_data->x.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;
 
   return;
 }
@@ -562,6 +582,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);
@@ -911,13 +935,13 @@ __inline void convert_pixels_to_time(
     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_d = ltt_time_to_double(window_time_interval);
+  time_d = time_d / (double)width * (double)x;
+  *time = ltt_time_from_double(time_d);
   *time = ltt_time_add(window_time_begin, *time);
 }
 
@@ -930,19 +954,24 @@ __inline void convert_time_to_pixels(
     guint *x)
 {
   LttTime window_time_interval;
-  guint64 time_ll, interval_ll;
-  
+  double time_d, interval_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, window_time_begin);
   
-  time_ll = ltt_time_to_uint64(time);
-  interval_ll = ltt_time_to_uint64(window_time_interval);
-
-  *x = (guint)(time_ll * width / interval_ll);
+  time_d = ltt_time_to_double(time);
+  interval_d = ltt_time_to_double(window_time_interval);
+  
+  if(interval_d == 0.0) {
+    g_assert(time_d == 0.0);
+    *x = 0;
+  } else {
+    *x = (guint)(time_d / interval_d * (double)width);
+  }
   
 }
 
This page took 0.023939 seconds and 4 git commands to generate.