//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 */
{ 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
#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];
}
+/* 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;
return prop_line;
}
-
+#endif //0
/* before_schedchange_hook
{
/* 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);
}
{
/* 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);
}
#endif //0
}
+#if 0
static __inline PropertiesLine prepare_execmode_line(LttvProcessState *process)
{
PropertiesLine prop_line;
return prop_line;
}
-
+#endif //0
/* before_execmode_hook
/* 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 {
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;
{
/* 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;
}
}
{
/* 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);
}
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)
{
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 */