change control flow viewer : combine all information into one line
[lttv.git] / ltt / branches / poly / lttv / modules / gui / controlflow / drawing.c
index e877e6d99cca540a9ce60c896db30db0c5150b17..9b977199fa973dc971395f2876cef4958302e82a 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,7 +54,40 @@ 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
+RUN+TRAP
+RUN+IRQ
+WAIT+foncé
+WAIT CPU + WAIT FORK vert foncé ou jaune
+IRQ rouge
+TRAP: orange
+SYSCALL: bleu pâle
 
+ZOMBIE + WAIT EXIT
+*/
 
 
 /*****************************************************************************
@@ -145,8 +178,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
@@ -261,7 +293,6 @@ void drawing_data_request(Drawing_t *drawing,
 
       
       /* Add these hooks to each event_by_id hooks list */
-
       /* add before */
       for(k = 0 ; k < hooks->len/2 ; k++) {
         hook = g_array_index(hooks, LttvTraceHook, k);
@@ -847,6 +878,11 @@ Drawing_t *drawing_construct(ControlFlowData *control_flow_data)
   gtk_widget_show(drawing->scrollbar);
   gtk_widget_show(drawing->hbox);
 
+  /* Allocate the colors */
+  GdkColormap* colormap = gdk_colormap_get_system();
+  gboolean success[NUM_COLORS];
+  gdk_colormap_alloc_colors(colormap, drawing_colors, NUM_COLORS, FALSE,
+                            TRUE, success);
   
   return drawing;
 }
@@ -854,6 +890,14 @@ Drawing_t *drawing_construct(ControlFlowData *control_flow_data)
 void drawing_destroy(Drawing_t *drawing)
 {
   g_info("drawing_destroy %p", drawing);
+
+  /* Free the colors */
+  GdkColormap* colormap = gdk_colormap_get_system();
+
+  gdk_colormap_free_colors(colormap, drawing_colors, NUM_COLORS);
+  
+
+
   // Do not unref here, Drawing_t destroyed by it's widget.
   //g_object_unref( G_OBJECT(drawing->drawing_area));
   if(drawing->gc != NULL)
@@ -917,8 +961,13 @@ __inline void convert_time_to_pixels(
   
   time_ll = ltt_time_to_uint64(time);
   interval_ll = ltt_time_to_uint64(window_time_interval);
-
-  *x = (guint)(time_ll * width / interval_ll);
+  
+  if(interval_ll == 0) {
+    g_assert(time_ll == 0);
+    *x = 0;
+  } else {
+    *x = (guint)(time_ll * width / interval_ll);
+  }
   
 }
 
This page took 0.023936 seconds and 4 git commands to generate.