state.c: softirqs cannot be pending more than once
[lttv.git] / ltt / branches / poly / lttv / modules / gui / controlflow / eventhooks.c
index c30ed2ae3c82a1555fc2056de1d651f1d4fc631e..cffd9b89b9ccc6051f82beb2172af29fe5a81122 100644 (file)
@@ -61,7 +61,6 @@
 
 #include <ltt/event.h>
 #include <ltt/time.h>
-#include <ltt/type.h>
 #include <ltt/trace.h>
 
 #include <lttv/lttv.h>
@@ -218,48 +217,6 @@ h_guicontrolflow(LttvPlugin *plugin)
   
 }
 
-void legend_destructor(GtkWindow *legend)
-{
-  g_legend_list = g_slist_remove(g_legend_list, legend);
-}
-
-/* Create a popup legend */
-GtkWidget *
-h_legend(LttvPlugin *plugin)
-{
-  LttvPluginTab *ptab = LTTV_PLUGIN_TAB(plugin);
-  Tab *tab = ptab->tab;
-  g_info("h_legend, %p", tab);
-
-  GtkWindow *legend = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL));
-  g_legend_list = g_slist_append(
-      g_legend_list,
-      legend);
-  g_object_set_data_full(
-      G_OBJECT(legend),
-      "legend",
-      legend,
-      (GDestroyNotify)legend_destructor);
-  
-  gtk_window_set_title(legend, "Control Flow View Legend");
-
-  GtkWidget *pixmap = create_pixmap(GTK_WIDGET(legend), "lttv-color-list.png");
-  
- // GtkImage *image = GTK_IMAGE(gtk_image_new_from_pixmap(
- //                               GDK_PIXMAP(pixmap), NULL));
-  
-  gtk_container_add(GTK_CONTAINER(legend), GTK_WIDGET(pixmap));
-
-  gtk_widget_show(GTK_WIDGET(pixmap));
-  gtk_widget_show(GTK_WIDGET(legend));
-  
-
-  return NULL; /* This is a popup window */
-}
-
-
 int event_selected_hook(void *hook_data, void *call_data)
 {
   ControlFlowData *control_flow_data = (ControlFlowData*) hook_data;
@@ -309,6 +266,8 @@ static inline PropertiesLine prepare_s_e_line(LttvProcessState *process)
     prop_line.color = drawing_colors[COL_EXIT];
   } else if(process->state->s == LTTV_STATE_UNNAMED) {
     prop_line.color = drawing_colors[COL_UNNAMED];
+  } else if(process->state->s == LTTV_STATE_DEAD) {
+    prop_line.color = drawing_colors[COL_DEAD];
   } else {
                g_critical("unknown state : %s", g_quark_to_string(process->state->s));
     g_assert(FALSE);   /* UNKNOWN STATE */
@@ -339,8 +298,8 @@ static inline PropertiesLine prepare_s_e_line(LttvProcessState *process)
 
 int before_schedchange_hook(void *hook_data, void *call_data)
 {
-  LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
-  EventsRequest *events_request = (EventsRequest*)thf->hook_data;
+  LttvTraceHook *th = (LttvTraceHook*)hook_data;
+  EventsRequest *events_request = (EventsRequest*)th->hook_data;
   ControlFlowData *control_flow_data = events_request->viewer_data;
 
   LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
@@ -362,9 +321,11 @@ int before_schedchange_hook(void *hook_data, void *call_data)
 
   guint pid_out;
   guint pid_in;
+  guint state_out;
   {
-    pid_out = ltt_event_get_long_unsigned(e, thf->f1);
-    pid_in = ltt_event_get_long_unsigned(e, thf->f2);
+    pid_out = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0));
+    pid_in = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 1));
+    state_out = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 2));
   }
   
   tfc->target_pid = pid_out;
@@ -440,7 +401,7 @@ int before_schedchange_hook(void *hook_data, void *call_data)
 #ifdef EXTRA_CHECK
           if(ltt_time_compare(evtime, time_window.start_time) == -1
                 || ltt_time_compare(evtime, time_window.end_time) == 1)
-                    return;
+                    return FALSE;
 #endif //EXTRA_CHECK
           Drawing_t *drawing = control_flow_data->drawing;
           guint width = drawing->width;
@@ -465,7 +426,7 @@ int before_schedchange_hook(void *hook_data, void *call_data)
 #ifdef EXTRA_CHECK
         if(ltt_time_compare(evtime, time_window.start_time) == -1
               || ltt_time_compare(evtime, time_window.end_time) == 1)
-                  return;
+                  return FALSE;
 #endif //EXTRA_CHECK
         Drawing_t *drawing = control_flow_data->drawing;
         guint width = drawing->width;
@@ -604,7 +565,7 @@ int before_schedchange_hook(void *hook_data, void *call_data)
 #ifdef EXTRA_CHECK
           if(ltt_time_compare(evtime, time_window.start_time) == -1
                 || ltt_time_compare(evtime, time_window.end_time) == 1)
-                    return;
+                    return FALSE;
 #endif //EXTRA_CHECK
           Drawing_t *drawing = control_flow_data->drawing;
           guint width = drawing->width;
@@ -629,7 +590,7 @@ int before_schedchange_hook(void *hook_data, void *call_data)
 #ifdef EXTRA_CHECK
         if(ltt_time_compare(evtime, time_window.start_time) == -1
               || ltt_time_compare(evtime, time_window.end_time) == 1)
-                  return;
+                  return FALSE;
 #endif //EXTRA_CHECK
         Drawing_t *drawing = control_flow_data->drawing;
         guint width = drawing->width;
@@ -738,8 +699,8 @@ int before_schedchange_hook(void *hook_data, void *call_data)
  */
 int after_schedchange_hook(void *hook_data, void *call_data)
 {
-  LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
-  EventsRequest *events_request = (EventsRequest*)thf->hook_data;
+  LttvTraceHook *th = (LttvTraceHook*)hook_data;
+  EventsRequest *events_request = (EventsRequest*)th->hook_data;
   ControlFlowData *control_flow_data = events_request->viewer_data;
 
   LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
@@ -752,11 +713,6 @@ int after_schedchange_hook(void *hook_data, void *call_data)
   e = ltt_tracefile_get_event(tfc->tf);
 
   LttvFilter *filter = control_flow_data->filter;
-  if(filter != NULL && filter->head != NULL)
-    if(!lttv_filter_tree_parse(filter->head,e,tfc->tf,
-          tfc->t_context->t,tfc,NULL,NULL))
-      return FALSE;
-
   LttTime evtime = ltt_event_time(e);
 
   /* Add process to process list (if not present) */
@@ -770,83 +726,88 @@ int after_schedchange_hook(void *hook_data, void *call_data)
   guint pid_in;
   {
     guint pid_out;
-    pid_out = ltt_event_get_long_unsigned(e, thf->f1);
-    pid_in = ltt_event_get_long_unsigned(e, thf->f2);
+    pid_out = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0));
+    pid_in = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 1));
   }
 
-
-  /* Find process pid_in in the list... */
-  //process_in = lttv_state_find_process(ts, ANY_CPU, pid_in);
-  //process_in = tfs->process;
-  guint cpu = tfs->cpu;
-  guint trace_num = ts->parent.index;
-  process_in = ts->running_process[cpu];
-  /* It should exist, because we are after the state update. */
+  tfc->target_pid = pid_in;
+  if(!filter || !filter->head ||
+    lttv_filter_tree_parse(filter->head,e,tfc->tf,
+          tfc->t_context->t,tfc,NULL,NULL)) { 
+    /* Find process pid_in in the list... */
+    //process_in = lttv_state_find_process(ts, ANY_CPU, pid_in);
+    //process_in = tfs->process;
+    guint cpu = tfs->cpu;
+    guint trace_num = ts->parent.index;
+    process_in = ts->running_process[cpu];
+    /* It should exist, because we are after the state update. */
 #ifdef EXTRA_CHECK
-  g_assert(process_in != NULL);
+    g_assert(process_in != NULL);
 #endif //EXTRA_CHECK
-  birth = process_in->creation_time;
-
-  hashed_process_data_in = processlist_get_process_data(process_list,
+    birth = process_in->creation_time;
+  
+    hashed_process_data_in = processlist_get_process_data(process_list,
+            pid_in,
+            process_in->cpu,
+            &birth,
+            trace_num);
+    if(hashed_process_data_in == NULL)
+    {
+      g_assert(pid_in == 0 || pid_in != process_in->ppid);
+      ProcessInfo *process_info;
+      Drawing_t *drawing = control_flow_data->drawing;
+      /* Process not present */
+      processlist_add(process_list,
+          drawing,
           pid_in,
+          process_in->tgid,
           process_in->cpu,
+          process_in->ppid,
           &birth,
-          trace_num);
-  if(hashed_process_data_in == NULL)
-  {
-    g_assert(pid_in == 0 || pid_in != process_in->ppid);
-    ProcessInfo *process_info;
-    Drawing_t *drawing = control_flow_data->drawing;
-    /* Process not present */
-    processlist_add(process_list,
-        drawing,
-        pid_in,
-        process_in->tgid,
-        process_in->cpu,
-        process_in->ppid,
-        &birth,
-        trace_num,
-        process_in->name,
-        process_in->brand,
-        &pl_height,
-        &process_info,
-        &hashed_process_data_in);
-        gtk_widget_set_size_request(drawing->drawing_area,
-                                    -1,
-                                    pl_height);
-        gtk_widget_queue_draw(drawing->drawing_area);
-  }
-  /* Set the current process */
-  process_list->current_hash_data[trace_num][process_in->cpu] =
-                                             hashed_process_data_in;
-
-  if(ltt_time_compare(hashed_process_data_in->next_good_time,
-                          evtime) <= 0)
-  {
-    TimeWindow time_window = 
-    lttvwindow_get_time_window(control_flow_data->tab);
-
+          trace_num,
+          process_in->name,
+          process_in->brand,
+          &pl_height,
+          &process_info,
+          &hashed_process_data_in);
+          gtk_widget_set_size_request(drawing->drawing_area,
+                                      -1,
+                                      pl_height);
+          gtk_widget_queue_draw(drawing->drawing_area);
+    }
+    /* Set the current process */
+    process_list->current_hash_data[trace_num][process_in->cpu] =
+                                               hashed_process_data_in;
+  
+    if(ltt_time_compare(hashed_process_data_in->next_good_time,
+                            evtime) <= 0)
+    {
+      TimeWindow time_window = 
+      lttvwindow_get_time_window(control_flow_data->tab);
+  
 #ifdef EXTRA_CHECK
-    if(ltt_time_compare(evtime, time_window.start_time) == -1
-        || ltt_time_compare(evtime, time_window.end_time) == 1)
-            return;
+      if(ltt_time_compare(evtime, time_window.start_time) == -1
+          || ltt_time_compare(evtime, time_window.end_time) == 1)
+              return FALSE;
 #endif //EXTRA_CHECK
-    Drawing_t *drawing = control_flow_data->drawing;
-    guint width = drawing->width;
-    guint new_x;
-    
-    convert_time_to_pixels(
-        time_window,
-        evtime,
-        width,
-        &new_x);
-
-    if(hashed_process_data_in->x.middle != new_x) {
-      hashed_process_data_in->x.middle = new_x;
-      hashed_process_data_in->x.middle_used = FALSE;
-      hashed_process_data_in->x.middle_marked = FALSE;
+      Drawing_t *drawing = control_flow_data->drawing;
+      guint width = drawing->width;
+      guint new_x;
+      
+      convert_time_to_pixels(
+          time_window,
+          evtime,
+          width,
+          &new_x);
+  
+      if(hashed_process_data_in->x.middle != new_x) {
+        hashed_process_data_in->x.middle = new_x;
+        hashed_process_data_in->x.middle_used = FALSE;
+        hashed_process_data_in->x.middle_marked = FALSE;
+      }
     }
   }
+
   return 0;
 }
 
@@ -873,8 +834,8 @@ int after_schedchange_hook(void *hook_data, void *call_data)
 
 int before_execmode_hook(void *hook_data, void *call_data)
 {
-  LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
-  EventsRequest *events_request = (EventsRequest*)thf->hook_data;
+  LttvTraceHook *th = (LttvTraceHook*)hook_data;
+  EventsRequest *events_request = (EventsRequest*)th->hook_data;
   ControlFlowData *control_flow_data = events_request->viewer_data;
 
   LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
@@ -967,7 +928,7 @@ int before_execmode_hook(void *hook_data, void *call_data)
 #ifdef EXTRA_CHECK
       if(ltt_time_compare(evtime, time_window.start_time) == -1
             || ltt_time_compare(evtime, time_window.end_time) == 1)
-                return;
+                return FALSE;
 #endif //EXTRA_CHECK
       Drawing_t *drawing = control_flow_data->drawing;
       guint width = drawing->width;
@@ -993,7 +954,7 @@ int before_execmode_hook(void *hook_data, void *call_data)
 #ifdef EXTRA_CHECK
     if(ltt_time_compare(evtime, time_window.start_time) == -1
           || ltt_time_compare(evtime, time_window.end_time) == 1)
-              return;
+              return FALSE;
 #endif //EXTRA_CHECK
     Drawing_t *drawing = control_flow_data->drawing;
     guint width = drawing->width;
@@ -1076,8 +1037,8 @@ int before_execmode_hook(void *hook_data, void *call_data)
 
 int before_process_exit_hook(void *hook_data, void *call_data)
 {
-  LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
-  EventsRequest *events_request = (EventsRequest*)thf->hook_data;
+  LttvTraceHook *th = (LttvTraceHook*)hook_data;
+  EventsRequest *events_request = (EventsRequest*)th->hook_data;
 
   ControlFlowData *control_flow_data = events_request->viewer_data;
 
@@ -1162,7 +1123,7 @@ int before_process_exit_hook(void *hook_data, void *call_data)
 #ifdef EXTRA_CHECK
       if(ltt_time_compare(evtime, time_window.start_time) == -1
             || ltt_time_compare(evtime, time_window.end_time) == 1)
-                return;
+                return FALSE;
 #endif //EXTRA_CHECK
       Drawing_t *drawing = control_flow_data->drawing;
       guint width = drawing->width;
@@ -1188,7 +1149,7 @@ int before_process_exit_hook(void *hook_data, void *call_data)
 #ifdef EXTRA_CHECK
     if(ltt_time_compare(evtime, time_window.start_time) == -1
           || ltt_time_compare(evtime, time_window.end_time) == 1)
-              return;
+              return FALSE;
 #endif //EXTRA_CHECK
     Drawing_t *drawing = control_flow_data->drawing;
     guint width = drawing->width;
@@ -1274,8 +1235,8 @@ int before_process_exit_hook(void *hook_data, void *call_data)
 
 int before_process_release_hook(void *hook_data, void *call_data)
 {
-  LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
-  EventsRequest *events_request = (EventsRequest*)thf->hook_data;
+  LttvTraceHook *th = (LttvTraceHook*)hook_data;
+  EventsRequest *events_request = (EventsRequest*)th->hook_data;
 
   ControlFlowData *control_flow_data = events_request->viewer_data;
 
@@ -1300,7 +1261,7 @@ int before_process_release_hook(void *hook_data, void *call_data)
 
   guint pid;
   {
-    pid = ltt_event_get_long_unsigned(e, thf->f1);
+    pid = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0));
   }
 
   /* Add process to process list (if not present) */
@@ -1326,29 +1287,11 @@ int before_process_release_hook(void *hook_data, void *call_data)
           &birth,
           trace_num);
     if(unlikely(hashed_process_data == NULL))
-    {
-      g_assert(pid == 0 || pid != process->ppid);
-      /* Process not present */
-      Drawing_t *drawing = control_flow_data->drawing;
-      ProcessInfo *process_info;
-      processlist_add(process_list,
-          drawing,
-          pid,
-          process->tgid,
-          process->cpu,
-          process->ppid,
-          &birth,
-          trace_num,
-          process->name,
-          process->brand,
-          &pl_height,
-          &process_info,
-          &hashed_process_data);
-      gtk_widget_set_size_request(drawing->drawing_area,
-                                  -1,
-                                  pl_height);
-      gtk_widget_queue_draw(drawing->drawing_area);
-    }
+      /*
+       * Process already been scheduled out EXIT_DEAD, not in the process list
+       * anymore. Just return.
+       */
+      return FALSE;
 
     /* Now, the process is in the state hash and our own process hash.
      * We definitely can draw the items related to the ending state.
@@ -1364,7 +1307,7 @@ int before_process_release_hook(void *hook_data, void *call_data)
 #ifdef EXTRA_CHECK
         if(ltt_time_compare(evtime, time_window.start_time) == -1
               || ltt_time_compare(evtime, time_window.end_time) == 1)
-                  return;
+                  return FALSE;
 #endif //EXTRA_CHECK
         Drawing_t *drawing = control_flow_data->drawing;
         guint width = drawing->width;
@@ -1390,7 +1333,7 @@ int before_process_release_hook(void *hook_data, void *call_data)
 #ifdef EXTRA_CHECK
       if(ltt_time_compare(evtime, time_window.start_time) == -1
             || ltt_time_compare(evtime, time_window.end_time) == 1)
-                return;
+                return FALSE;
 #endif //EXTRA_CHECK
       Drawing_t *drawing = control_flow_data->drawing;
       guint width = drawing->width;
@@ -1477,8 +1420,8 @@ int before_process_release_hook(void *hook_data, void *call_data)
  */
 int after_process_fork_hook(void *hook_data, void *call_data)
 {
-  LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
-  EventsRequest *events_request = (EventsRequest*)thf->hook_data;
+  LttvTraceHook *th = (LttvTraceHook*)hook_data;
+  EventsRequest *events_request = (EventsRequest*)th->hook_data;
   ControlFlowData *control_flow_data = events_request->viewer_data;
 
   LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
@@ -1500,7 +1443,7 @@ int after_process_fork_hook(void *hook_data, void *call_data)
 
   guint child_pid;
   {
-    child_pid = ltt_event_get_long_unsigned(e, thf->f2);
+    child_pid = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 1));
   }
 
   /* Add process to process list (if not present) */
@@ -1566,7 +1509,7 @@ int after_process_fork_hook(void *hook_data, void *call_data)
 #ifdef EXTRA_CHECK
     if(ltt_time_compare(evtime, time_window.start_time) == -1
           || ltt_time_compare(evtime, time_window.end_time) == 1)
-              return;
+              return FALSE;
 #endif //EXTRA_CHECK
     Drawing_t *drawing = control_flow_data->drawing;
     guint width = drawing->width;
@@ -1593,7 +1536,7 @@ int after_process_fork_hook(void *hook_data, void *call_data)
       hashed_process_data_child->x.under_marked = FALSE;
     }
   }
-  return 0;
+  return FALSE;
 }
 
 
@@ -1611,8 +1554,8 @@ int after_process_fork_hook(void *hook_data, void *call_data)
  */
 int after_process_exit_hook(void *hook_data, void *call_data)
 {
-  LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
-  EventsRequest *events_request = (EventsRequest*)thf->hook_data;
+  LttvTraceHook *th = (LttvTraceHook*)hook_data;
+  EventsRequest *events_request = (EventsRequest*)th->hook_data;
   ControlFlowData *control_flow_data = events_request->viewer_data;
 
   LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
@@ -1697,7 +1640,7 @@ int after_process_exit_hook(void *hook_data, void *call_data)
 #ifdef EXTRA_CHECK
     if(ltt_time_compare(evtime, time_window.start_time) == -1
           || ltt_time_compare(evtime, time_window.end_time) == 1)
-              return;
+              return FALSE;
 #endif //EXTRA_CHECK
     Drawing_t *drawing = control_flow_data->drawing;
     guint width = drawing->width;
@@ -1714,15 +1657,15 @@ int after_process_exit_hook(void *hook_data, void *call_data)
     }
   }
 
-  return 0;
+  return FALSE;
 }
 
 
 /* Get the filename of the process to print */
 int after_fs_exec_hook(void *hook_data, void *call_data)
 {
-  LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
-  EventsRequest *events_request = (EventsRequest*)thf->hook_data;
+  LttvTraceHook *th = (LttvTraceHook*)hook_data;
+  EventsRequest *events_request = (EventsRequest*)th->hook_data;
   ControlFlowData *control_flow_data = events_request->viewer_data;
 
   LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
@@ -1802,8 +1745,8 @@ int after_fs_exec_hook(void *hook_data, void *call_data)
 /* Get the filename of the process to print */
 int after_user_generic_thread_brand_hook(void *hook_data, void *call_data)
 {
-  LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
-  EventsRequest *events_request = (EventsRequest*)thf->hook_data;
+  LttvTraceHook *th = (LttvTraceHook*)hook_data;
+  EventsRequest *events_request = (EventsRequest*)th->hook_data;
   ControlFlowData *control_flow_data = events_request->viewer_data;
 
   LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
@@ -1894,8 +1837,8 @@ int after_user_generic_thread_brand_hook(void *hook_data, void *call_data)
  */
 int after_event_enum_process_hook(void *hook_data, void *call_data)
 {
-  LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
-  EventsRequest *events_request = (EventsRequest*)thf->hook_data;
+  LttvTraceHook *th = (LttvTraceHook*)hook_data;
+  EventsRequest *events_request = (EventsRequest*)th->hook_data;
   ControlFlowData *control_flow_data = events_request->viewer_data;
 
   LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
@@ -1904,6 +1847,8 @@ int after_event_enum_process_hook(void *hook_data, void *call_data)
 
   LttvTraceState *ts = (LttvTraceState *)tfc->t_context;
 
+  guint first_cpu, nb_cpus, cpu;
+
   LttEvent *e;
   e = ltt_tracefile_get_event(tfc->tf);
 
@@ -1926,60 +1871,69 @@ int after_event_enum_process_hook(void *hook_data, void *call_data)
   
   guint pid_in;
   {
-    pid_in = ltt_event_get_long_unsigned(e, thf->f1);
+    pid_in = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0));
+  }
+  
+  if(pid_in == 0) {
+    first_cpu = 0;
+    nb_cpus = ltt_trace_get_num_cpu(ts->parent.t);
+  } else {
+    first_cpu = ANY_CPU;
+    nb_cpus = ANY_CPU+1;
   }
 
-
-  /* Find process pid_in in the list... */
-  process_in = lttv_state_find_process(ts, ANY_CPU, pid_in);
-  //process_in = tfs->process;
-  //guint cpu = tfs->cpu;
-  //guint trace_num = ts->parent.index;
-  //process_in = ts->running_process[cpu];
-  /* It should exist, because we are after the state update. */
-#ifdef EXTRA_CHECK
-  //g_assert(process_in != NULL);
-#endif //EXTRA_CHECK
-  birth = process_in->creation_time;
-
-  hashed_process_data_in = processlist_get_process_data(process_list,
+  for(cpu = first_cpu; cpu < nb_cpus; cpu++) {
+    /* Find process pid_in in the list... */
+    process_in = lttv_state_find_process(ts, cpu, pid_in);
+    //process_in = tfs->process;
+    //guint cpu = tfs->cpu;
+    //guint trace_num = ts->parent.index;
+    //process_in = ts->running_process[cpu];
+    /* It should exist, because we are after the state update. */
+  #ifdef EXTRA_CHECK
+    //g_assert(process_in != NULL);
+  #endif //EXTRA_CHECK
+    birth = process_in->creation_time;
+
+    hashed_process_data_in = processlist_get_process_data(process_list,
+            pid_in,
+            process_in->cpu,
+            &birth,
+            trace_num);
+    if(hashed_process_data_in == NULL)
+    {
+      if(pid_in != 0 && pid_in == process_in->ppid)
+        g_critical("TEST %u , %u", pid_in, process_in->ppid);
+      g_assert(pid_in == 0 || pid_in != process_in->ppid);
+      ProcessInfo *process_info;
+      Drawing_t *drawing = control_flow_data->drawing;
+      /* Process not present */
+      processlist_add(process_list,
+          drawing,
           pid_in,
+          process_in->tgid,
           process_in->cpu,
+          process_in->ppid,
           &birth,
-          trace_num);
-  if(hashed_process_data_in == NULL)
-  {
-               if(pid_in != 0 && pid_in == process_in->ppid)
-                       g_critical("TEST %u , %u", pid_in, process_in->ppid);
-    g_assert(pid_in == 0 || pid_in != process_in->ppid);
-    ProcessInfo *process_info;
-    Drawing_t *drawing = control_flow_data->drawing;
-    /* Process not present */
-    processlist_add(process_list,
-        drawing,
-        pid_in,
-        process_in->tgid,
-        process_in->cpu,
-        process_in->ppid,
-        &birth,
-        trace_num,
-        process_in->name,
-        process_in->brand,
-        &pl_height,
-        &process_info,
-        &hashed_process_data_in);
-        gtk_widget_set_size_request(drawing->drawing_area,
-                                    -1,
-                                    pl_height);
-        gtk_widget_queue_draw(drawing->drawing_area);
-  } else {
-          processlist_set_name(process_list, process_in->name,
-                               hashed_process_data_in);
-          processlist_set_ppid(process_list, process_in->ppid,
-                               hashed_process_data_in);
-          processlist_set_tgid(process_list, process_in->tgid,
-                               hashed_process_data_in);
-       }
+          trace_num,
+          process_in->name,
+          process_in->brand,
+          &pl_height,
+          &process_info,
+          &hashed_process_data_in);
+          gtk_widget_set_size_request(drawing->drawing_area,
+                                      -1,
+                                      pl_height);
+          gtk_widget_queue_draw(drawing->drawing_area);
+    } else {
+      processlist_set_name(process_list, process_in->name,
+                           hashed_process_data_in);
+      processlist_set_ppid(process_list, process_in->ppid,
+                           hashed_process_data_in);
+      processlist_set_tgid(process_list, process_in->tgid,
+                           hashed_process_data_in);
+    }
+  }
   return 0;
 }
 
@@ -2396,6 +2350,8 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data)
 
   LttTime evtime = closure_data->end_time;
 
+  gboolean dodraw = TRUE;
+
   { 
     /* For the process */
     /* First, check if the current process is in the state computation
@@ -2438,7 +2394,7 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data)
        if(filter != NULL && filter->head != NULL)
          if(!lttv_filter_tree_parse(filter->head,NULL,NULL,
              tc->t,NULL,process,tc))
-           return FALSE;
+           dodraw = FALSE;
 
       /* Only draw for processes that are currently in the trace states */
 
@@ -2521,8 +2477,10 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data)
         } else {
           draw_context.drawinfo.start.x = hashed_process_data->x.middle;
           /* Draw the line */
-          PropertiesLine prop_line = prepare_s_e_line(process);
-          draw_line((void*)&prop_line, (void*)&draw_context);
+          if(dodraw) {
+                  PropertiesLine prop_line = prepare_s_e_line(process);
+                  draw_line((void*)&prop_line, (void*)&draw_context);
+          }
 
            /* become the last x position */
           if(likely(x != hashed_process_data->x.middle)) {
@@ -2689,8 +2647,8 @@ int after_chunk(void *hook_data, void *call_data)
  */
 int before_statedump_end(void *hook_data, void *call_data)
 {
-  LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
-  EventsRequest *events_request = (EventsRequest*)thf->hook_data;
+  LttvTraceHook *th = (LttvTraceHook*)hook_data;
+  EventsRequest *events_request = (EventsRequest*)th->hook_data;
   ControlFlowData *control_flow_data = events_request->viewer_data;
 
   LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
This page took 0.032043 seconds and 4 git commands to generate.