multiple traces/tracefiles change
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 4 Feb 2004 16:07:15 +0000 (16:07 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 4 Feb 2004 16:07:15 +0000 (16:07 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@480 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/include/lttv/state.h
ltt/branches/poly/lttv/main/state.c
ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c
ltt/branches/poly/lttv/modules/gui/controlflow/drawitem.c
ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c
ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c
ltt/branches/poly/lttv/modules/gui/controlflow/processlist.h

index 8131bb8b1944da5c03a13dd378ad77d1721f20f3..4205c27cf2fe107bb1c3df9f0bc5742c403bfded 100644 (file)
@@ -140,8 +140,9 @@ typedef struct _LttvProcessState {
   /* opened file descriptors, address map?... */
 } LttvProcessState;
 
-
+//FIXME : find by pid and birth time : both are necessary to be unique
 LttvProcessState *lttv_state_find_process(LttvTracefileState *tfs, guint pid);
+LttvProcessState *lttv_state_find_process_from_trace(LttvTraceState *ts, guint pid);
 
 
 /* The LttvTracesetState, LttvTraceState and LttvTracefileState types
@@ -183,6 +184,7 @@ struct _LttvTraceState {
   GQuark *trap_names;
   GQuark *irq_names;
   gboolean recompute_state_in_seek;
+  gboolean saved_state_ready;
   gboolean saved_state_available;
 };
 
index f9d123e03a5f8d3051a9b4c337b817f577d3cd09..2fb4527921b3949234e6af2f5959637298716d8e 100644 (file)
@@ -61,6 +61,9 @@ static void lttv_state_free_process_table(GHashTable *processes);
 static LttvProcessState *create_process(LttvTracefileState *tfs, 
                                 LttvProcessState *parent, guint pid);
 
+static LttvProcessState *create_process_from_trace(LttvTraceState *ts, 
+                                LttvProcessState *parent, guint pid);
+
 void lttv_state_save(LttvTraceState *self, LttvAttribute *container)
 {
   LTTV_TRACE_STATE_GET_CLASS(self)->state_save(self, container);
@@ -585,6 +588,54 @@ static LttvProcessState *create_process(LttvTracefileState *tfs,
   return process;
 }
 
+static LttvProcessState *create_process_from_trace(LttvTraceState *tcs, 
+    LttvProcessState *parent, guint pid)
+{
+  LttvProcessState *process = g_new(LttvProcessState, 1);
+
+  LttvExecutionState *es;
+
+  LttvTraceContext *tc = (LttvTraceContext *)tcs;
+
+  char buffer[128];
+
+  g_hash_table_insert(tcs->processes, GUINT_TO_POINTER(pid), process);
+  process->pid = pid;
+
+  if(parent) {
+    process->ppid = parent->pid;
+    process->name = parent->name;
+  }
+  else {
+    process->ppid = 0;
+    process->name = LTTV_STATE_UNNAMED;
+  }
+
+  //FIXME timestamp should come from trace
+  process->creation_time.tv_sec = 0;
+  process->creation_time.tv_nsec = 0;
+  sprintf(buffer,"%d-%lu.%lu",pid, process->creation_time.tv_sec, 
+         process->creation_time.tv_nsec);
+  process->pid_time = g_quark_from_string(buffer);
+  process->execution_stack = g_array_new(FALSE, FALSE, 
+      sizeof(LttvExecutionState));
+  g_array_set_size(process->execution_stack, 1);
+  es = process->state = &g_array_index(process->execution_stack, 
+      LttvExecutionState, 0);
+  es->t = LTTV_STATE_USER_MODE;
+  es->n = LTTV_STATE_SUBMODE_NONE;
+  //FIXME es->entry = tfs->parent.timestamp;
+  es->entry.tv_sec = 0;
+  es->entry.tv_nsec = 0;
+  //FIXME es->change = tfs->parent.timestamp;
+  es->change.tv_sec = 0;
+  es->change.tv_nsec = 0;
+  es->s = LTTV_STATE_WAIT_FORK;
+
+  return process;
+}
+
+
 
 LttvProcessState *lttv_state_find_process(LttvTracefileState *tfs, 
     guint pid)
@@ -596,6 +647,17 @@ LttvProcessState *lttv_state_find_process(LttvTracefileState *tfs,
   return process;
 }
 
+LttvProcessState *lttv_state_find_process_from_trace(LttvTraceState *ts, 
+    guint pid)
+{
+  LttvProcessState *process = g_hash_table_lookup(ts->processes, 
+      GUINT_TO_POINTER(pid));
+  
+  if(process == NULL) process = create_process_from_trace(ts, NULL, pid);
+  return process;
+}
+
+
 
 static void exit_process(LttvTracefileState *tfs, LttvProcessState *process) 
 {
index 6edf56684bb6f326599170d31721709871651c76..2a43501361047db10abf59f0f3caefbf02692652 100644 (file)
@@ -108,7 +108,7 @@ void drawing_data_request(Drawing_t *drawing,
   LttvTracesetContext * tsc =
         get_traceset_context(control_flow_data->mw);
   LttvTracesetState * tss =
-        LTTV_TRACESET_STATE(tsc);
+        (LttvTracesetState*)tsc;
   
     //send_test_process(
   //guicontrolflow_get_process_list(drawing->control_flow_data),
@@ -145,15 +145,15 @@ void drawing_data_request(Drawing_t *drawing,
   // FIXME : would like to place the after_traceset hook after the traceset,
   // but the traceset context state is not valid anymore.
   lttv_traceset_context_add_hooks(tsc,
-  //    NULL, after_traceset, NULL, NULL, NULL, NULL,
-      NULL, NULL, NULL, NULL, NULL, NULL,
-      NULL, after_traceset, NULL, event, after_event);
+      NULL, after_traceset, NULL, NULL, NULL, NULL,
+      //NULL, NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, event, after_event);
   lttv_process_traceset(tsc, end, G_MAXULONG);
   //after_data_request((void*)&event_request,(void*)tsc);
   lttv_traceset_context_remove_hooks(tsc,
-      //NULL, after_traceset, NULL, NULL, NULL, NULL,
-      NULL, NULL, NULL, NULL, NULL, NULL,
-      NULL, after_traceset, NULL, event, after_event);
+      NULL, after_traceset, NULL, NULL, NULL, NULL,
+     // NULL, NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, NULL, event, after_event);
   //Modified by xiangxiu: state update hooks are removed by the main window
   //state_remove_event_hooks_api(control_flow_data->mw);
 
index b2b8fb977872b40ff8495a8da195645f4bb12a84..6d535fa566d4420ecd218df0b3fd8623a05e560a 100644 (file)
@@ -265,6 +265,11 @@ gboolean draw_line( void *hook_data, void *call_data)
                               Properties->style,
                               GDK_CAP_BUTT,
                               GDK_JOIN_MITER);
+  //g_critical("DRAWING LINE : x1: %i, y1: %i, x2:%i, y2:%i", 
+  //    Draw_Context->previous->middle->x,
+  //    Draw_Context->previous->middle->y,
+  //    Draw_Context->current->middle->x,
+  //    Draw_Context->current->middle->y);
 
   switch(Properties->position) {
     case OVER:
@@ -351,13 +356,19 @@ gboolean draw_bg( void *hook_data, void *call_data)
   //gdk_gc_set_foreground(Draw_Context->gc, Properties->color);
   gdk_gc_set_rgb_fg_color(Draw_Context->gc, Properties->color);
 
-
+  //g_critical("DRAWING RECT : x: %i, y: %i, w:%i, h:%i, val1 :%i, val2:%i ", 
+  //    Draw_Context->previous->over->x,
+  //    Draw_Context->previous->over->y,
+  //    Draw_Context->current->over->x - Draw_Context->previous->over->x,
+  //    Draw_Context->previous->under->y-Draw_Context->previous->over->y,
+  //    Draw_Context->current->over->x,
+  //    Draw_Context->previous->over->x);
   gdk_draw_rectangle(Draw_Context->drawable, Draw_Context->gc,
           TRUE,
           Draw_Context->previous->over->x,
           Draw_Context->previous->over->y,
           Draw_Context->current->over->x - Draw_Context->previous->over->x,
-          Draw_Context->previous->under->y);
+          Draw_Context->previous->under->y-Draw_Context->previous->over->y);
 
   return 0;
 }
index 9beac5d486318bce81337fdc3ce518a815a1186e..8a5c6b9ad8262fe07eacd03a9928b4cba83b4515 100644 (file)
@@ -203,6 +203,7 @@ int draw_event_hook(void *hook_data, void *call_data)
     if(processlist_get_process_pixels(process_list,
             pid_out,
             &birth,
+            tfc->t_context->index,
             &y_out,
             &height,
             &hashed_process_data_out) == 1)
@@ -211,12 +212,14 @@ int draw_event_hook(void *hook_data, void *call_data)
     processlist_add(process_list,
         pid_out,
         &birth,
+        tfc->t_context->index,
         name,
         &pl_height,
         &hashed_process_data_out);
     processlist_get_process_pixels(process_list,
             pid_out,
             &birth,
+            tfc->t_context->index,
             &y_out,
             &height,
             &hashed_process_data_out);
@@ -236,6 +239,7 @@ int draw_event_hook(void *hook_data, void *call_data)
     if(processlist_get_process_pixels(process_list,
             pid_in,
             &birth,
+            tfc->t_context->index,
             &y_in,
             &height,
             &hashed_process_data_in) == 1)
@@ -244,12 +248,14 @@ int draw_event_hook(void *hook_data, void *call_data)
       processlist_add(process_list,
         pid_in,
         &birth,
+        tfc->t_context->index,
         name,
         &pl_height,
         &hashed_process_data_in);
       processlist_get_process_pixels(process_list,
             pid_in,
             &birth,
+            tfc->t_context->index,
             &y_in,
             &height,
             &hashed_process_data_in);
@@ -289,13 +295,79 @@ int draw_event_hook(void *hook_data, void *call_data)
     draw_context_out->pango_layout = control_flow_data->drawing->pango_layout;
     GtkWidget *widget = control_flow_data->drawing->drawing_area;
     //draw_context_out->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)];
-    draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
-    gdk_gc_copy(draw_context_out->gc, widget->style->black_gc);
+    //draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
+    //gdk_gc_copy(draw_context_out->gc, widget->style->black_gc);
     //draw_context_out->gc = widget->style->black_gc;
     
     //draw_arc((void*)&prop_arc, (void*)draw_context_out);
     //test_draw_item(control_flow_data->drawing, control_flow_data->drawing->pixmap);
     
+    /* Draw the line/background of the out process */
+    if(draw_context_out->previous->middle->x == -1)
+    {
+      draw_context_out->previous->over->x = event_request->x_begin;
+      draw_context_out->previous->middle->x = event_request->x_begin;
+      draw_context_out->previous->under->x = event_request->x_begin;
+
+      g_critical("out middle x_beg : %u",event_request->x_begin);
+    }
+  
+    draw_context_out->current->middle->x = x;
+    draw_context_out->current->over->x = x;
+    draw_context_out->current->under->x = x;
+    draw_context_out->current->middle->y = y_out + height/2;
+    draw_context_out->current->over->y = y_out;
+    draw_context_out->current->under->y = y_out + height;
+    draw_context_out->previous->middle->y = y_out + height/2;
+    draw_context_out->previous->over->y = y_out;
+    draw_context_out->previous->under->y = y_out + height;
+
+    draw_context_out->drawable = control_flow_data->drawing->pixmap;
+    draw_context_out->pango_layout = control_flow_data->drawing->pango_layout;
+
+    if(process_out->state->s == LTTV_STATE_RUN)
+    {
+      draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
+      gdk_gc_copy(draw_context_out->gc, widget->style->black_gc);
+
+      PropertiesBG prop_bg;
+      prop_bg.color = g_new(GdkColor,1);
+      
+      switch(tfc->index) {
+        case 0:
+          prop_bg.color->red = 0x1515;
+          prop_bg.color->green = 0x1515;
+          prop_bg.color->blue = 0x8c8c;
+          break;
+        case 1:
+          prop_bg.color->red = 0x4e4e;
+          prop_bg.color->green = 0xa9a9;
+          prop_bg.color->blue = 0xa4a4;
+          break;
+        case 2:
+          prop_bg.color->red = 0x7a7a;
+          prop_bg.color->green = 0x4a4a;
+          prop_bg.color->blue = 0x8b8b;
+          break;
+        case 3:
+          prop_bg.color->red = 0x8080;
+          prop_bg.color->green = 0x7777;
+          prop_bg.color->blue = 0x4747;
+          break;
+        default:
+          prop_bg.color->red = 0xe7e7;
+          prop_bg.color->green = 0xe7e7;
+          prop_bg.color->blue = 0xe7e7;
+      }
+      
+      g_critical("calling from draw_event");
+      draw_bg((void*)&prop_bg, (void*)draw_context_out);
+      g_free(prop_bg.color);
+      gdk_gc_unref(draw_context_out->gc);
+    }
+
+    draw_context_out->gc = widget->style->black_gc;
+
     GdkColor colorfg_out = { 0, 0xffff, 0x0000, 0x0000 };
     GdkColor colorbg_out = { 0, 0x0000, 0x0000, 0x0000 };
     PropertiesText prop_text_out;
@@ -366,21 +438,8 @@ int draw_event_hook(void *hook_data, void *call_data)
       prop_text_out.text = "U";
     
     draw_text((void*)&prop_text_out, (void*)draw_context_out);
-    gdk_gc_unref(draw_context_out->gc);
+    //gdk_gc_unref(draw_context_out->gc);
 
-    /* Draw the line of the out process */
-    if(draw_context_out->previous->middle->x == -1)
-    {
-      draw_context_out->previous->middle->x = event_request->x_begin;
-      g_critical("out middle x_beg : %u",event_request->x_begin);
-    }
-  
-    draw_context_out->current->middle->x = x;
-    draw_context_out->current->middle->y = y_out + height/2;
-    draw_context_out->previous->middle->y = y_out + height/2;
-    draw_context_out->drawable = control_flow_data->drawing->pixmap;
-    draw_context_out->pango_layout = control_flow_data->drawing->pango_layout;
-    //draw_context_out->gc = widget->style->black_gc;
     draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
     gdk_gc_copy(draw_context_out->gc, widget->style->black_gc);
 
@@ -453,12 +512,78 @@ int draw_event_hook(void *hook_data, void *call_data)
     widget = control_flow_data->drawing->drawing_area;
     //draw_context_in->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)];
     //draw_context_in->gc = widget->style->black_gc;
-    draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
-    gdk_gc_copy(draw_context_in->gc, widget->style->black_gc);
+    //draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
+    //gdk_gc_copy(draw_context_in->gc, widget->style->black_gc);
     
     //draw_arc((void*)&prop_arc, (void*)draw_context_in);
     //test_draw_item(control_flow_data->drawing, control_flow_data->drawing->pixmap);
+      
+    /* Draw the line/bg of the in process */
+    if(draw_context_in->previous->middle->x == -1)
+    {
+      draw_context_in->previous->middle->x = event_request->x_begin;
+      draw_context_in->previous->over->x = event_request->x_begin;
+      draw_context_in->previous->under->x = event_request->x_begin;
+      g_critical("in middle x_beg : %u",event_request->x_begin);
+    }
+  
+    draw_context_in->current->middle->x = x;
+    draw_context_in->current->over->x = x;
+    draw_context_in->current->under->x = x;
+    draw_context_in->current->middle->y = y_in + height/2;
+    draw_context_in->current->over->y = y_in;
+    draw_context_in->current->under->y = y_in + height;
+    draw_context_in->previous->middle->y = y_in + height/2;
+    draw_context_in->previous->over->y = y_in;
+    draw_context_in->previous->under->y = y_in + height;
     
+    draw_context_in->drawable = control_flow_data->drawing->pixmap;
+    draw_context_in->pango_layout = control_flow_data->drawing->pango_layout;
+
+    if(process_in->state->s == LTTV_STATE_RUN)
+    {
+      draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
+      gdk_gc_copy(draw_context_in->gc, widget->style->black_gc);
+
+      PropertiesBG prop_bg;
+      prop_bg.color = g_new(GdkColor,1);
+        
+      switch(tfc->index) {
+        case 0:
+          prop_bg.color->red = 0x1515;
+          prop_bg.color->green = 0x1515;
+          prop_bg.color->blue = 0x8c8c;
+          break;
+        case 1:
+          prop_bg.color->red = 0x4e4e;
+          prop_bg.color->green = 0xa9a9;
+          prop_bg.color->blue = 0xa4a4;
+          break;
+        case 2:
+          prop_bg.color->red = 0x7a7a;
+          prop_bg.color->green = 0x4a4a;
+          prop_bg.color->blue = 0x8b8b;
+          break;
+        case 3:
+          prop_bg.color->red = 0x8080;
+          prop_bg.color->green = 0x7777;
+          prop_bg.color->blue = 0x4747;
+          break;
+        default:
+          prop_bg.color->red = 0xe7e7;
+          prop_bg.color->green = 0xe7e7;
+          prop_bg.color->blue = 0xe7e7;
+      }
+      
+
+      draw_bg((void*)&prop_bg, (void*)draw_context_in);
+      g_free(prop_bg.color);
+      gdk_gc_unref(draw_context_in->gc);
+    }
+
+    draw_context_in->gc = widget->style->black_gc;
+
     GdkColor colorfg_in = { 0, 0x0000, 0xffff, 0x0000 };
     GdkColor colorbg_in = { 0, 0x0000, 0x0000, 0x0000 };
     PropertiesText prop_text_in;
@@ -531,24 +656,11 @@ int draw_event_hook(void *hook_data, void *call_data)
       prop_text_in.text = "U";
     
     draw_text((void*)&prop_text_in, (void*)draw_context_in);
-    gdk_gc_unref(draw_context_in->gc);
-    
-    /* Draw the line of the in process */
-    if(draw_context_in->previous->middle->x == -1)
-    {
-      draw_context_in->previous->middle->x = event_request->x_begin;
-      g_critical("in middle x_beg : %u",event_request->x_begin);
-    }
-  
-    draw_context_in->current->middle->x = x;
-    draw_context_in->previous->middle->y = y_in + height/2;
-    draw_context_in->current->middle->y = y_in + height/2;
-    draw_context_in->drawable = control_flow_data->drawing->pixmap;
-    draw_context_in->pango_layout = control_flow_data->drawing->pango_layout;
-    //draw_context_in->gc = widget->style->black_gc;
+    //gdk_gc_unref(draw_context_in->gc);
+   
     draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
     gdk_gc_copy(draw_context_in->gc, widget->style->black_gc);
-    
+
     PropertiesLine prop_line_in;
     prop_line_in.color = g_new(GdkColor,1);
     prop_line_in.line_width = 2;
@@ -689,6 +801,7 @@ int draw_after_hook(void *hook_data, void *call_data)
     if(processlist_get_process_pixels(process_list,
             pid_out,
             &birth,
+            tfc->t_context->index,
             &y_out,
             &height,
             &hashed_process_data_out) == 1)
@@ -697,12 +810,14 @@ int draw_after_hook(void *hook_data, void *call_data)
     processlist_add(process_list,
         pid_out,
         &birth,
+        tfc->t_context->index,
         name,
         &pl_height,
         &hashed_process_data_out);
     processlist_get_process_pixels(process_list,
             pid_out,
             &birth,
+            tfc->t_context->index,
             &y_out,
             &height,
             &hashed_process_data_out);
@@ -722,6 +837,7 @@ int draw_after_hook(void *hook_data, void *call_data)
     if(processlist_get_process_pixels(process_list,
             pid_in,
             &birth,
+            tfc->t_context->index,
             &y_in,
             &height,
             &hashed_process_data_in) == 1)
@@ -730,12 +846,14 @@ int draw_after_hook(void *hook_data, void *call_data)
       processlist_add(process_list,
         pid_in,
         &birth,
+        tfc->t_context->index,
         name,
         &pl_height,
         &hashed_process_data_in);
       processlist_get_process_pixels(process_list,
             pid_in,
             &birth,
+            tfc->t_context->index,
             &y_in,
             &height,
             &hashed_process_data_in);
@@ -775,11 +893,28 @@ int draw_after_hook(void *hook_data, void *call_data)
     draw_context_out->pango_layout = control_flow_data->drawing->pango_layout;
     GtkWidget *widget = control_flow_data->drawing->drawing_area;
     //draw_context_out->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)];
-    draw_context_out->gc = widget->style->black_gc;
-    
     //draw_arc((void*)&prop_arc, (void*)draw_context_out);
     //test_draw_item(control_flow_data->drawing, control_flow_data->drawing->pixmap);
-    
+     
+    /*if(process_out->state->s == LTTV_STATE_RUN)
+    {
+      draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
+      gdk_gc_copy(draw_context_out->gc, widget->style->black_gc);
+      PropertiesBG prop_bg;
+      prop_bg.color = g_new(GdkColor,1);
+      
+      prop_bg.color->red = 0xffff;
+      prop_bg.color->green = 0xffff;
+      prop_bg.color->blue = 0xffff;
+      
+      draw_bg((void*)&prop_bg, (void*)draw_context_out);
+      g_free(prop_bg.color);
+      gdk_gc_unref(draw_context_out->gc);
+    }*/
+
+    draw_context_out->gc = widget->style->black_gc;
+
     GdkColor colorfg_out = { 0, 0xffff, 0x0000, 0x0000 };
     GdkColor colorbg_out = { 0, 0x0000, 0x0000, 0x0000 };
     PropertiesText prop_text_out;
@@ -849,8 +984,12 @@ int draw_after_hook(void *hook_data, void *call_data)
       prop_text_out.text = "U";
     
     draw_text((void*)&prop_text_out, (void*)draw_context_out);
+
+    //gdk_gc_unref(draw_context_out->gc);
  
     draw_context_out->current->middle->y = y_out+height/2;
+    draw_context_out->current->over->y = y_out;
+    draw_context_out->current->under->y = y_out+height;
     draw_context_out->current->status = process_out->state->s;
     
     /* for pid_out : remove previous, Prev = current, new current (default) */
@@ -895,11 +1034,28 @@ int draw_after_hook(void *hook_data, void *call_data)
     draw_context_in->pango_layout = control_flow_data->drawing->pango_layout;
     widget = control_flow_data->drawing->drawing_area;
     //draw_context_in->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)];
-    draw_context_in->gc = widget->style->black_gc;
     
     //draw_arc((void*)&prop_arc, (void*)draw_context_in);
     //test_draw_item(control_flow_data->drawing, control_flow_data->drawing->pixmap);
-    
+     
+    /*if(process_in->state->s == LTTV_STATE_RUN)
+    {
+      draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
+      gdk_gc_copy(draw_context_in->gc, widget->style->black_gc);
+      PropertiesBG prop_bg;
+      prop_bg.color = g_new(GdkColor,1);
+      
+      prop_bg.color->red = 0xffff;
+      prop_bg.color->green = 0xffff;
+      prop_bg.color->blue = 0xffff;
+      
+      draw_bg((void*)&prop_bg, (void*)draw_context_in);
+      g_free(prop_bg.color);
+      gdk_gc_unref(draw_context_in->gc);
+    }*/
+
+    draw_context_in->gc = widget->style->black_gc;
+
     GdkColor colorfg_in = { 0, 0x0000, 0xffff, 0x0000 };
     GdkColor colorbg_in = { 0, 0x0000, 0x0000, 0x0000 };
     PropertiesText prop_text_in;
@@ -971,6 +1127,7 @@ int draw_after_hook(void *hook_data, void *call_data)
     
     draw_text((void*)&prop_text_in, (void*)draw_context_in);
     
+
     if(process_in->state->s == LTTV_STATE_RUN)
     { 
       gchar tmp[255];
@@ -993,6 +1150,8 @@ int draw_after_hook(void *hook_data, void *call_data)
 
     
     draw_context_in->current->middle->y = y_in+height/2;
+    draw_context_in->current->over->y = y_in;
+    draw_context_in->current->under->y = y_in+height;
     draw_context_in->current->status = process_in->state->s;
 
     /* for pid_in : remove previous, Prev = current, new current (default) */
@@ -1302,7 +1461,7 @@ gint update_current_time_hook(void *hook_data, void *call_data)
 
 typedef struct _ClosureData {
   EventRequest *event_request;
-  LttvTraceState *ts;
+  LttvTracesetState *tss;
 } ClosureData;
   
 
@@ -1327,29 +1486,78 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data)
           &height);
   /* Get last state of process */
   LttvTraceContext *tc =
-    (LttvTraceContext *)closure_data->ts;
+    ((LttvTracesetContext*)closure_data->tss)->traces[process_info->trace_num];
+  //LttvTracefileContext *tfc = (LttvTracefileContext *)closure_data->ts;
 
-  LttvTraceState *ts = closure_data->ts;
+  LttvTraceState *ts = (LttvTraceState*)tc;
   LttvProcessState *process;
 
-  process = lttv_state_find_process((LttvTracefileState*)ts, process_info->pid);
+  process = lttv_state_find_process_from_trace(ts, process_info->pid);
   
   /* Draw the closing line */
   DrawContext *draw_context = hashed_process_data->draw_context;
   if(draw_context->previous->middle->x == -1)
   {
     draw_context->previous->middle->x = closure_data->event_request->x_begin;
+    draw_context->previous->over->x = closure_data->event_request->x_begin;
+    draw_context->previous->under->x = closure_data->event_request->x_begin;
     g_critical("out middle x_beg : %u",closure_data->event_request->x_begin);
   }
 
   draw_context->current->middle->x = closure_data->event_request->x_end;
+  draw_context->current->over->x = closure_data->event_request->x_end;
+  draw_context->current->under->x = closure_data->event_request->x_end;
   draw_context->current->middle->y = y + height/2;
+  draw_context->current->over->y = y ;
+  draw_context->current->under->y = y + height;
   draw_context->previous->middle->y = y + height/2;
+  draw_context->previous->over->y = y ;
+  draw_context->previous->under->y = y + height;
   draw_context->drawable = control_flow_data->drawing->pixmap;
   draw_context->pango_layout = control_flow_data->drawing->pango_layout;
   //draw_context->gc = widget->style->black_gc;
   draw_context->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
   gdk_gc_copy(draw_context->gc, widget->style->black_gc);
+  if(process->state->s == LTTV_STATE_RUN)
+  {
+    PropertiesBG prop_bg;
+    prop_bg.color = g_new(GdkColor,1);
+
+    /*switch(tfc->index) {
+      case 0:
+        prop_bg.color->red = 0x1515;
+        prop_bg.color->green = 0x1515;
+        prop_bg.color->blue = 0x8c8c;
+        break;
+      case 1:
+        prop_bg.color->red = 0x4e4e;
+        prop_bg.color->green = 0xa9a9;
+        prop_bg.color->blue = 0xa4a4;
+      break;
+      case 2:
+        prop_bg.color->red = 0x7a7a;
+        prop_bg.color->green = 0x4a4a;
+        prop_bg.color->blue = 0x8b8b;
+        break;
+      case 3:
+        prop_bg.color->red = 0x8080;
+        prop_bg.color->green = 0x7777;
+        prop_bg.color->blue = 0x4747;
+        break;
+      default:
+        prop_bg.color->red = 0xe7e7;
+        prop_bg.color->green = 0xe7e7;
+        prop_bg.color->blue = 0xe7e7;
+    }
+    */
+
+    g_critical("calling from closure");
+    //FIXME : I need the cpu number in process's state to draw this.
+    //draw_bg((void*)&prop_bg, (void*)draw_context);
+    g_free(prop_bg.color);
+  }
+
 
   PropertiesLine prop_line;
   prop_line.color = g_new(GdkColor,1);
@@ -1455,7 +1663,7 @@ int  after_data_request(void *hook_data, void *call_data)
 
   ClosureData closure_data;
   closure_data.event_request = (EventRequest*)hook_data;
-  closure_data.ts = (LttvTraceState*)call_data;
+  closure_data.tss = (LttvTracesetState*)call_data;
 
   g_hash_table_foreach(process_list->process_hash, draw_closure,
                         (void*)&closure_data);
index 1d4333f876eeb5efde0719d2d98060e3d677521e..4145f745ddbdaeeccee2447f69b1b2b096e30452 100644 (file)
@@ -33,6 +33,7 @@ enum
   PID_COLUMN,
   BIRTH_S_COLUMN,
   BIRTH_NS_COLUMN,
+  TRACE_COLUMN,
   N_COLUMNS
 };
 
@@ -146,6 +147,37 @@ gint process_sort_func  ( GtkTreeModel *model,
   g_value_unset(&a);
   g_value_unset(&b);
 
+  /* Order by trace_num */
+  gtk_tree_model_get_value( model,
+          it_a,
+          TRACE_COLUMN,
+          &a);
+
+  gtk_tree_model_get_value( model,
+          it_b,
+          TRACE_COLUMN,
+          &b);
+
+  if(G_VALUE_TYPE(&a) == G_TYPE_ULONG
+    && G_VALUE_TYPE(&b) == G_TYPE_ULONG )
+  {
+    if(g_value_get_ulong(&a) > g_value_get_ulong(&b))
+    {
+      g_value_unset(&a);
+      g_value_unset(&b);
+      return 1;
+    }
+    if(g_value_get_ulong(&a) < g_value_get_ulong(&b))
+    {
+      g_value_unset(&a);
+      g_value_unset(&b);
+      return 0;
+    }
+
+  }
+
+
+
   return 0;
 
 }
@@ -168,6 +200,9 @@ gboolean equ_fct(gconstpointer a, gconstpointer b)
     return 0;
 //  g_critical("compare %u and %u",((ProcessInfo*)a)->birth.tv_nsec,((ProcessInfo*)b)->birth.tv_nsec);
 
+  if(((ProcessInfo*)a)->trace_num != ((ProcessInfo*)b)->trace_num)
+    return 0;
+
   return 1;
 }
 
@@ -192,6 +227,7 @@ ProcessList *processlist_construct(void)
               G_TYPE_STRING,
               G_TYPE_UINT,
               G_TYPE_ULONG,
+              G_TYPE_ULONG,
               G_TYPE_ULONG);
 
 
@@ -263,6 +299,15 @@ ProcessList *processlist_construct(void)
   gtk_tree_view_append_column (
     GTK_TREE_VIEW (process_list->process_list_widget), column);
 
+  column = gtk_tree_view_column_new_with_attributes ( "TRACE",
+                renderer,
+                "text",
+                TRACE_COLUMN,
+                NULL);
+  gtk_tree_view_append_column (
+    GTK_TREE_VIEW (process_list->process_list_widget), column);
+
+
   //gtk_tree_view_column_set_visible(column, 0);
   
   g_object_set_data_full(
@@ -315,6 +360,7 @@ void destroy_hash_data(gpointer data)
 int processlist_add(  ProcessList *process_list,
       guint pid,
       LttTime *birth,
+      guint trace_num,
       gchar *name,
       guint *height,
       HashedProcessData **pm_hashed_process_data)
@@ -326,6 +372,7 @@ int processlist_add(  ProcessList *process_list,
   
   Process_Info->pid = pid;
   Process_Info->birth = *birth;
+  Process_Info->trace_num = trace_num;
   
   hashed_process_data->draw_context = g_new(DrawContext, 1);
   hashed_process_data->draw_context->drawable = NULL;
@@ -383,6 +430,7 @@ int processlist_add(  ProcessList *process_list,
         PID_COLUMN, pid,
         BIRTH_S_COLUMN, birth->tv_sec,
         BIRTH_NS_COLUMN, birth->tv_nsec,
+        TRACE_COLUMN, trace_num,
         -1);
   hashed_process_data->row_ref = gtk_tree_row_reference_new (
       GTK_TREE_MODEL(process_list->list_store),
@@ -409,7 +457,8 @@ int processlist_add(  ProcessList *process_list,
 
 int processlist_remove( ProcessList *process_list,
       guint pid,
-      LttTime *birth)
+      LttTime *birth,
+      guint trace_num)
 {
   ProcessInfo Process_Info;
   gint *path_indices;
@@ -418,6 +467,7 @@ int processlist_remove( ProcessList *process_list,
   
   Process_Info.pid = pid;
   Process_Info.birth = *birth;
+  Process_Info.trace_num = trace_num;
 
 
   if(hashed_process_data = 
@@ -471,7 +521,7 @@ guint processlist_get_height(ProcessList *process_list)
 
 
 gint processlist_get_process_pixels(  ProcessList *process_list,
-          guint pid, LttTime *birth,
+          guint pid, LttTime *birth, guint trace_num,
           guint *y,
           guint *height,
           HashedProcessData **pm_hashed_process_data)
@@ -483,6 +533,7 @@ gint processlist_get_process_pixels(  ProcessList *process_list,
 
   Process_Info.pid = pid;
   Process_Info.birth = *birth;
+  Process_Info.trace_num = trace_num;
 
   if(hashed_process_data = 
     (HashedProcessData*)g_hash_table_lookup(
index 75eda09ae1348a550f44ca7730941c0e2b44c803..20d39b9b8637a2d5701801942ea11828e9dfec9e 100644 (file)
@@ -45,6 +45,7 @@ typedef struct _ProcessInfo {
   
   guint pid;
   LttTime birth;
+  guint trace_num;
 
 } ProcessInfo;
 
@@ -75,15 +76,17 @@ GtkWidget *processlist_get_widget(ProcessList *process_list);
 
 // out : success (0) and height
 int processlist_add(ProcessList *process_list, guint pid, LttTime *birth,
-    gchar *name, guint *height, HashedProcessData **hashed_process_data);
+    guint trace_num, gchar *name, guint *height,
+    HashedProcessData **hashed_process_data);
 // out : success (0) and height
-int processlist_remove(ProcessList *process_list, guint pid, LttTime *birth);
+int processlist_remove(ProcessList *process_list, guint pid, LttTime *birth,
+    guint trace_num);
 
 guint processlist_get_height(ProcessList *process_list);
 
 // Returns 0 on success
 gint processlist_get_process_pixels(ProcessList *process_list,
-        guint pid, LttTime *birth,
+        guint pid, LttTime *birth, guint trace_num,
         guint *y, guint *height,
         HashedProcessData **hashed_process_data);
 
This page took 0.036826 seconds and 4 git commands to generate.