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

ltt/branches/poly/lttv/main/state.c
ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c

index 2fb4527921b3949234e6af2f5959637298716d8e..0fa74a1c47ca25774bffca668d822a4235936575 100644 (file)
@@ -61,9 +61,6 @@ 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);
@@ -588,55 +585,6 @@ 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)
 {
@@ -652,8 +600,10 @@ LttvProcessState *lttv_state_find_process_from_trace(LttvTraceState *ts,
 {
   LttvProcessState *process = g_hash_table_lookup(ts->processes, 
       GUINT_TO_POINTER(pid));
-  
-  if(process == NULL) process = create_process_from_trace(ts, NULL, pid);
+  //We do not create a process at this level, because we can be called
+  //from outside of state.c, and therefore cannot assume a tracefile
+  //exists.
+  //if(process == NULL) process = create_process_from_trace(ts, NULL, pid);
   return process;
 }
 
index 8a5c6b9ad8262fe07eacd03a9928b4cba83b4515..c4160db702bf631b013cec9183e912948691cf33 100644 (file)
@@ -1519,7 +1519,7 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data)
   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)
+  if(process != NULL && process->state->s == LTTV_STATE_RUN)
   {
     PropertiesBG prop_bg;
     prop_bg.color = g_new(GdkColor,1);
@@ -1566,47 +1566,57 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data)
   prop_line.position = MIDDLE;
 
   /* color of line : status of the process */
-  if(process->state->s == LTTV_STATE_UNNAMED)
+  if(process != NULL)
   {
-    prop_line.color->red = 0xffff;
-    prop_line.color->green = 0xffff;
-    prop_line.color->blue = 0xffff;
-  }
-  else if(process->state->s == LTTV_STATE_WAIT_FORK)
-  {
-    prop_line.color->red = 0x0fff;
-    prop_line.color->green = 0xffff;
-    prop_line.color->blue = 0xfff0;
-  }
-  else if(process->state->s == LTTV_STATE_WAIT_CPU)
-  {
-    prop_line.color->red = 0xffff;
-    prop_line.color->green = 0xffff;
-    prop_line.color->blue = 0x0000;
-  }
-  else if(process->state->s == LTTV_STATE_EXIT)
-  {
-    prop_line.color->red = 0xffff;
-    prop_line.color->green = 0x0000;
-    prop_line.color->blue = 0xffff;
-  }
-  else if(process->state->s == LTTV_STATE_WAIT)
-  {
-    prop_line.color->red = 0xffff;
-    prop_line.color->green = 0x0000;
-    prop_line.color->blue = 0x0000;
-  }
-  else if(process->state->s == LTTV_STATE_RUN)
-  {
-    prop_line.color->red = 0x0000;
-    prop_line.color->green = 0xffff;
-    prop_line.color->blue = 0x0000;
+    if(process->state->s == LTTV_STATE_UNNAMED)
+    {
+      prop_line.color->red = 0xffff;
+      prop_line.color->green = 0xffff;
+      prop_line.color->blue = 0xffff;
+    }
+    else if(process->state->s == LTTV_STATE_WAIT_FORK)
+    {
+      prop_line.color->red = 0x0fff;
+      prop_line.color->green = 0xffff;
+      prop_line.color->blue = 0xfff0;
+    }
+    else if(process->state->s == LTTV_STATE_WAIT_CPU)
+    {
+      prop_line.color->red = 0xffff;
+      prop_line.color->green = 0xffff;
+      prop_line.color->blue = 0x0000;
+    }
+    else if(process->state->s == LTTV_STATE_EXIT)
+    {
+      prop_line.color->red = 0xffff;
+      prop_line.color->green = 0x0000;
+      prop_line.color->blue = 0xffff;
+    }
+    else if(process->state->s == LTTV_STATE_WAIT)
+    {
+      prop_line.color->red = 0xffff;
+      prop_line.color->green = 0x0000;
+      prop_line.color->blue = 0x0000;
+    }
+    else if(process->state->s == LTTV_STATE_RUN)
+    {
+      prop_line.color->red = 0x0000;
+      prop_line.color->green = 0xffff;
+      prop_line.color->blue = 0x0000;
+    }
+    else
+    {
+      prop_line.color->red = 0xffff;
+      prop_line.color->green = 0xffff;
+      prop_line.color->blue = 0xffff;
+    }
+
   }
   else
   {
-    prop_line.color->red = 0xffff;
-    prop_line.color->green = 0xffff;
-    prop_line.color->blue = 0xffff;
+      prop_line.color->red = 0xffff;
+      prop_line.color->green = 0xffff;
+      prop_line.color->blue = 0xffff;
   }
 
   draw_line((void*)&prop_line, (void*)draw_context);
This page took 0.028026 seconds and 4 git commands to generate.