change control flow viewer : combine all information into one line
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 13 Aug 2004 15:52:13 +0000 (15:52 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 13 Aug 2004 15:52:13 +0000 (15:52 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@722 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c
ltt/branches/poly/lttv/modules/gui/controlflow/drawing.h
ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c

index fa1c144ef4da90e97ea4e9bff84ed5100c4e09f3..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,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
index bac0b6b8ad7a860b128997b2e3bbcdc04ae701d0..0dd8ae892fffa9cf973964bb2a1af3478b2ec0c9 100644 (file)
 
 #define SAFETY 50 // safety pixels at right and bottom of pixmap buffer
 
-
-typedef enum _draw_color { COL_BLACK,
-                           COL_WHITE,
-                           COL_WAIT_FORK,
-                           COL_WAIT_CPU,
-                           COL_EXIT,
-                           COL_ZOMBIE,
-                           COL_WAIT,
-                           COL_RUN,
-                           COL_USER_MODE,
-                           COL_SYSCALL,
-                           COL_TRAP,
-                           COL_IRQ,
-                           COL_MODE_UNKNOWN,
-                           NUM_COLORS } draw_color;
+typedef enum _draw_color {
+                COL_BLACK,
+                COL_WHITE,
+                COL_RUN_USER_MODE,/* green */
+                COL_RUN_SYSCALL,  /* pale blue */
+                COL_RUN_TRAP,     /* yellow */
+                COL_RUN_IRQ,      /* red */
+                COL_WAIT,         /* dark red */
+                COL_WAIT_CPU,     /* dark yellow */
+                COL_ZOMBIE,       /* dark purple */
+                COL_WAIT_FORK,    /* dark green */
+                COL_EXIT,         /* "less dark" magenta */
+                COL_MODE_UNKNOWN, /* white */
+                COL_UNNAMED,      /* white */
+                NUM_COLORS } draw_color; 
 
 extern GdkColor drawing_colors[NUM_COLORS];
 
index a5f3eee18cf89a66a6f542d759668e80b7e6cc28..4441712a3d88c3ea2337bda5030aaaa38d0b40f6 100644 (file)
@@ -271,7 +271,54 @@ int event_selected_hook(void *hook_data, void *call_data)
   
 }
 
+/* Function that selects the color of status&exemode line */
+static __inline PropertiesLine prepare_s_e_line(LttvProcessState *process)
+{
+  PropertiesLine prop_line;
+  prop_line.line_width = 2;
+  prop_line.style = GDK_LINE_SOLID;
+  prop_line.y = MIDDLE;
+  //GdkColormap *colormap = gdk_colormap_get_system();
+  
+  g_debug("prepare_status_line for state : %s",
+      g_quark_to_string(process->state->s));
 
+  if(process->state->s == LTTV_STATE_RUN) {
+    if(process->state->t == LTTV_STATE_USER_MODE)
+      prop_line.color = drawing_colors[COL_RUN_USER_MODE];
+    else if(process->state->t == LTTV_STATE_SYSCALL)
+      prop_line.color = drawing_colors[COL_RUN_SYSCALL];
+    else if(process->state->t == LTTV_STATE_TRAP)
+      prop_line.color = drawing_colors[COL_RUN_TRAP];
+    else if(process->state->t == LTTV_STATE_IRQ)
+      prop_line.color = drawing_colors[COL_RUN_IRQ];
+    else if(process->state->t == LTTV_STATE_MODE_UNKNOWN)
+      prop_line.color = drawing_colors[COL_MODE_UNKNOWN];
+    else
+      g_assert(FALSE);   /* RUNNING MODE UNKNOWN */
+  } else if(process->state->s == LTTV_STATE_WAIT) {
+    /* We don't show if we wait while in user mode, trap, irq or syscall */
+    prop_line.color = drawing_colors[COL_WAIT];
+  } else if(process->state->s == LTTV_STATE_WAIT_CPU) {
+    /* We don't show if we wait for CPU while in user mode, trap, irq
+     * or syscall */
+    prop_line.color = drawing_colors[COL_WAIT_CPU];
+  } else if(process->state->s == LTTV_STATE_ZOMBIE) {
+    prop_line.color = drawing_colors[COL_ZOMBIE];
+  } else if(process->state->s == LTTV_STATE_WAIT_FORK) {
+    prop_line.color = drawing_colors[COL_WAIT_FORK];
+  } else if(process->state->s == LTTV_STATE_EXIT) {
+    prop_line.color = drawing_colors[COL_EXIT];
+  } else if(process->state->s == LTTV_STATE_UNNAMED) {
+    prop_line.color = drawing_colors[COL_UNNAMED];
+  } else
+    g_assert(FALSE);   /* UNKNOWN STATE */
+  
+  return prop_line;
+
+}
+
+#if 0
 static __inline PropertiesLine prepare_status_line(LttvProcessState *process)
 {
   PropertiesLine prop_line;
@@ -309,7 +356,7 @@ static __inline PropertiesLine prepare_status_line(LttvProcessState *process)
   return prop_line;
 
 }
-
+#endif //0
 
 
 /* before_schedchange_hook
@@ -474,7 +521,7 @@ int before_schedchange_hook(void *hook_data, void *call_data)
 
           {
             /* Draw the line */
-            PropertiesLine prop_line = prepare_status_line(process);
+            PropertiesLine prop_line = prepare_s_e_line(process);
             draw_line((void*)&prop_line, (void*)&draw_context);
 
           }
@@ -587,7 +634,7 @@ int before_schedchange_hook(void *hook_data, void *call_data)
 
           {
             /* Draw the line */
-            PropertiesLine prop_line = prepare_status_line(process);
+            PropertiesLine prop_line = prepare_s_e_line(process);
             draw_line((void*)&prop_line, (void*)&draw_context);
           }
 
@@ -1774,6 +1821,7 @@ int after_schedchange_hook(void *hook_data, void *call_data)
 #endif //0
 }
 
+#if 0
 static __inline PropertiesLine prepare_execmode_line(LttvProcessState *process)
 {
   PropertiesLine prop_line;
@@ -1804,7 +1852,7 @@ static __inline PropertiesLine prepare_execmode_line(LttvProcessState *process)
   return prop_line;
 
 }
-
+#endif //0
 
 
 /* before_execmode_hook
@@ -1926,7 +1974,7 @@ int before_execmode_hook(void *hook_data, void *call_data)
 
 
     /* Jump over draw if we are at the same x position */
-    if(x == hashed_process_data->x.over)
+    if(x == hashed_process_data->x.middle)
     {
       /* jump */
     } else {
@@ -1937,7 +1985,7 @@ int before_execmode_hook(void *hook_data, void *call_data)
       draw_context.drawable = drawing->pixmap;
       draw_context.gc = drawing->gc;
       draw_context.pango_layout = drawing->pango_layout;
-      draw_context.drawinfo.start.x = hashed_process_data->x.over;
+      draw_context.drawinfo.start.x = hashed_process_data->x.middle;
       draw_context.drawinfo.end.x = x;
 
       draw_context.drawinfo.y.over = y+1;
@@ -1953,12 +2001,12 @@ int before_execmode_hook(void *hook_data, void *call_data)
 
       {
         /* Draw the line */
-        PropertiesLine prop_line = prepare_execmode_line(process);
+        PropertiesLine prop_line = prepare_s_e_line(process);
         draw_line((void*)&prop_line, (void*)&draw_context);
 
       }
       /* become the last x position */
-      hashed_process_data->x.over = x;
+      hashed_process_data->x.middle = x;
     }
   }
   
@@ -2205,7 +2253,7 @@ int before_process_hook(void *hook_data, void *call_data)
 
         {
           /* Draw the line */
-          PropertiesLine prop_line = prepare_status_line(process);
+          PropertiesLine prop_line = prepare_s_e_line(process);
           draw_line((void*)&prop_line, (void*)&draw_context);
 
         }
@@ -2910,7 +2958,7 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data)
         draw_context.drawinfo.end.offset.over = 0;
         draw_context.drawinfo.end.offset.middle = 0;
         draw_context.drawinfo.end.offset.under = 0;
-
+#if 0
         /* Jump over draw if we are at the same x position */
         if(x == hashed_process_data->x.over)
         {
@@ -2923,13 +2971,14 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data)
 
           hashed_process_data->x.over = x;
         }
+#endif //0
 
         if(x == hashed_process_data->x.middle) {
           /* Jump */
         } else {
           draw_context.drawinfo.start.x = hashed_process_data->x.middle;
           /* Draw the line */
-          PropertiesLine prop_line = prepare_status_line(process);
+          PropertiesLine prop_line = prepare_s_e_line(process);
           draw_line((void*)&prop_line, (void*)&draw_context);
 
            /* become the last x position */
This page took 0.028824 seconds and 4 git commands to generate.