get name only if necessary
[lttv.git] / ltt / branches / poly / lttv / modules / gui / controlflow / eventhooks.c
index 732047de56afab81ea71bf3525980427ebce7d8f..5c828c284dfaf5a18970968289aff23d040ea3a2 100644 (file)
@@ -271,7 +271,7 @@ 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)
+static __inline__ PropertiesLine prepare_s_e_line(LttvProcessState *process)
 {
   PropertiesLine prop_line;
   prop_line.line_width = 2;
@@ -318,7 +318,7 @@ static __inline PropertiesLine prepare_s_e_line(LttvProcessState *process)
 }
 
 #if 0
-static __inline PropertiesLine prepare_status_line(LttvProcessState *process)
+static __inline__ PropertiesLine prepare_status_line(LttvProcessState *process)
 {
   PropertiesLine prop_line;
   prop_line.line_width = 2;
@@ -391,15 +391,7 @@ int before_schedchange_hook(void *hook_data, void *call_data)
   e = tfc->e;
 
   LttTime evtime = ltt_event_time(e);
-  TimeWindow time_window = 
-    lttvwindow_get_time_window(control_flow_data->tab);
 
-  LttTime end_time = time_window.end_time;
-#ifdef EXTRA_CHECK
-  if(ltt_time_compare(evtime, time_window.start_time) == -1
-        || ltt_time_compare(evtime, end_time) == 1)
-            return;
-#endif //EXTRA_CHECK
   guint width = drawing->width;
 
   /* we are in a schedchange, before the state update. We must draw the
@@ -439,7 +431,6 @@ int before_schedchange_hook(void *hook_data, void *call_data)
       HashedProcessData *hashed_process_data = NULL;
       ProcessList *process_list = control_flow_data->process_list;
       LttTime birth = process->creation_time;
-      const gchar *name = g_quark_to_string(process->name);
       
       if(processlist_get_process_pixels(process_list,
               pid_out,
@@ -451,6 +442,7 @@ int before_schedchange_hook(void *hook_data, void *call_data)
               &hashed_process_data) == 1)
       {
         g_assert(pid_out == 0 || pid_out != process->ppid);
+        const gchar *name = g_quark_to_string(process->name);
         /* Process not present */
         ProcessInfo *process_info;
         processlist_add(process_list,
@@ -485,6 +477,14 @@ int before_schedchange_hook(void *hook_data, void *call_data)
                           evtime) > 0)
       {
         if(hashed_process_data->x.middle_marked == FALSE) {
+          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;
+#endif //EXTRA_CHECK
+
           guint x;
           convert_time_to_pixels(
                     time_window,
@@ -501,6 +501,14 @@ int before_schedchange_hook(void *hook_data, void *call_data)
           hashed_process_data->x.middle_marked = TRUE;
         }
       } else {
+          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;
+#endif //EXTRA_CHECK
+
         guint x;
         convert_time_to_pixels(
                   time_window,
@@ -583,7 +591,6 @@ int before_schedchange_hook(void *hook_data, void *call_data)
       HashedProcessData *hashed_process_data = NULL;
       ProcessList *process_list = control_flow_data->process_list;
       LttTime birth = process->creation_time;
-      const gchar *name = g_quark_to_string(process->name);
       
       if(processlist_get_process_pixels(process_list,
               pid_in,
@@ -595,6 +602,7 @@ int before_schedchange_hook(void *hook_data, void *call_data)
               &hashed_process_data) == 1)
       {
         g_assert(pid_in == 0 || pid_in != process->ppid);
+        const gchar *name = g_quark_to_string(process->name);
         /* Process not present */
         ProcessInfo *process_info;
         processlist_add(process_list,
@@ -630,6 +638,13 @@ int before_schedchange_hook(void *hook_data, void *call_data)
                           evtime) > 0)
       {
         if(hashed_process_data->x.middle_marked == FALSE) {
+          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;
+#endif //EXTRA_CHECK
           guint x;
           convert_time_to_pixels(
                     time_window,
@@ -646,6 +661,13 @@ int before_schedchange_hook(void *hook_data, void *call_data)
           hashed_process_data->x.middle_marked = TRUE;
         }
       } else {
+        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;
+#endif //EXTRA_CHECK
         guint x;
 
         convert_time_to_pixels(
@@ -731,11 +753,11 @@ int before_schedchange_hook(void *hook_data, void *call_data)
   TimeWindow time_window = 
     lttvwindow_get_time_window(tab);
 
-  LttTime end_time = time_window.end_time;
+  LttTime time_window.end_time = time_window.time_window.end_time;
 
   //if(time < time_beg || time > time_end) return;
   if(ltt_time_compare(evtime, time_window.start_time) == -1
-        || ltt_time_compare(evtime, end_time) == 1)
+        || ltt_time_compare(evtime, time_window.end_time) == 1)
             return;
 
   if(strcmp(ltt_eventtype_name(ltt_event_eventtype(e)),"schedchange") == 0)
@@ -842,7 +864,7 @@ int before_schedchange_hook(void *hook_data, void *call_data)
 
     LttTime time = ltt_event_time(e);
 
-    LttTime window_end = time_window.end_time;
+    LttTime window_end = time_window.time_window.end_time;
     
     convert_time_to_pixels(
         time_window,
@@ -1346,16 +1368,6 @@ int after_schedchange_hook(void *hook_data, void *call_data)
   e = tfc->e;
 
   LttTime evtime = ltt_event_time(e);
-  TimeWindow time_window = 
-    lttvwindow_get_time_window(control_flow_data->tab);
-
-  LttTime end_time = time_window.end_time;
-
-#ifdef EXTRA_CHECK
-  if(ltt_time_compare(evtime, time_window.start_time) == -1
-        || ltt_time_compare(evtime, end_time) == 1)
-            return;
-#endif //EXTRA_CHECK
 
   guint width = control_flow_data->drawing->width;
 
@@ -1386,7 +1398,6 @@ int after_schedchange_hook(void *hook_data, void *call_data)
   g_assert(process_in != NULL);
 
   birth = process_in->creation_time;
-  const gchar *name = g_quark_to_string(process_in->name);
 
   if(processlist_get_process_pixels(process_list,
           pid_in,
@@ -1398,6 +1409,7 @@ int after_schedchange_hook(void *hook_data, void *call_data)
           &hashed_process_data_in) == 1)
   {
     g_assert(pid_in == 0 || pid_in != process_in->ppid);
+    const gchar *name = g_quark_to_string(process_in->name);
     ProcessInfo *process_info;
     /* Process not present */
     processlist_add(process_list,
@@ -1421,6 +1433,15 @@ int after_schedchange_hook(void *hook_data, void *call_data)
   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;
+#endif //EXTRA_CHECK
+
     guint new_x;
     
     convert_time_to_pixels(
@@ -1458,11 +1479,11 @@ int after_schedchange_hook(void *hook_data, void *call_data)
   TimeWindow time_window = 
     lttvwindow_get_time_window(control_flow_data->tab);
 
-  LttTime end_time = time_window.end_time;
+  LttTime time_window.end_time = time_window.time_window.end_time;
 
   //if(time < time_beg || time > time_end) return;
   if(ltt_time_compare(evtime, time_window.start_time) == -1
-        || ltt_time_compare(evtime, end_time) == 1)
+        || ltt_time_compare(evtime, time_window.end_time) == 1)
             return;
 
 
@@ -1571,7 +1592,7 @@ int after_schedchange_hook(void *hook_data, void *call_data)
 
     //LttTime time = ltt_event_time(e);
 
-    //LttTime window_end = time_window->end_time;
+    //LttTime window_end = time_window->time_window.end_time;
 
     
     //convert_time_to_pixels(
@@ -1892,7 +1913,7 @@ int after_schedchange_hook(void *hook_data, void *call_data)
 }
 
 #if 0
-static __inline PropertiesLine prepare_execmode_line(LttvProcessState *process)
+static __inline__ PropertiesLine prepare_execmode_line(LttvProcessState *process)
 {
   PropertiesLine prop_line;
   prop_line.line_width = 1;
@@ -1958,17 +1979,6 @@ int before_execmode_hook(void *hook_data, void *call_data)
   e = tfc->e;
 
   LttTime evtime = ltt_event_time(e);
-  TimeWindow time_window = 
-    lttvwindow_get_time_window(control_flow_data->tab);
-
-  LttTime end_time = time_window.end_time;
-
-#ifdef EXTRA_CHECK
-  if(ltt_time_compare(evtime, time_window.start_time) == -1
-        || ltt_time_compare(evtime, end_time) == 1)
-            return;
-#endif //EXTRA_CHECK
-
   guint width = drawing->width;
 
   /* we are in a execmode, before the state update. We must draw the
@@ -1989,7 +1999,6 @@ int before_execmode_hook(void *hook_data, void *call_data)
   HashedProcessData *hashed_process_data = NULL;
   ProcessList *process_list = control_flow_data->process_list;
   LttTime birth = process->creation_time;
-  const gchar *name = g_quark_to_string(process->name);
   
   if(processlist_get_process_pixels(process_list,
           pid,
@@ -2003,6 +2012,7 @@ int before_execmode_hook(void *hook_data, void *call_data)
     g_assert(pid == 0 || pid != process->ppid);
     ProcessInfo *process_info;
     /* Process not present */
+    const gchar *name = g_quark_to_string(process->name);
     processlist_add(process_list,
         pid,
         process->last_cpu,
@@ -2036,6 +2046,14 @@ int before_execmode_hook(void *hook_data, void *call_data)
                       evtime) > 0)
   {
     if(hashed_process_data->x.middle_marked == FALSE) {
+      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;
+#endif //EXTRA_CHECK
       guint x;
       convert_time_to_pixels(
                 time_window,
@@ -2052,6 +2070,14 @@ int before_execmode_hook(void *hook_data, void *call_data)
       hashed_process_data->x.middle_marked = TRUE;
     }
   } else {
+    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;
+#endif //EXTRA_CHECK
     guint x;
 
     convert_time_to_pixels(
@@ -2141,17 +2167,6 @@ int after_execmode_hook(void *hook_data, void *call_data)
   e = tfc->e;
 
   LttTime evtime = ltt_event_time(e);
-  TimeWindow time_window = 
-    lttvwindow_get_time_window(control_flow_data->tab);
-
-  LttTime end_time = time_window.end_time;
-
-#ifdef EXTRA_CHECK
-  if(ltt_time_compare(evtime, time_window.start_time) == -1
-        || ltt_time_compare(evtime, end_time) == 1)
-            return;
-#endif //EXTRA_CHECK
-
   guint width = control_flow_data->drawing->width;
 
   /* Add process to process list (if not present) */
@@ -2170,7 +2185,6 @@ int after_execmode_hook(void *hook_data, void *call_data)
   guint pid = process->pid;
 
   birth = process->creation_time;
-  const gchar *name = g_quark_to_string(process->name);
 
   if(processlist_get_process_pixels(process_list,
           pid,
@@ -2183,6 +2197,7 @@ int after_execmode_hook(void *hook_data, void *call_data)
   {
     g_assert(pid == 0 || pid != process->ppid);
     /* Process not present */
+    const gchar *name = g_quark_to_string(process->name);
     ProcessInfo *process_info;
     processlist_add(process_list,
         pid,
@@ -2205,6 +2220,16 @@ int after_execmode_hook(void *hook_data, void *call_data)
   if(ltt_time_compare(hashed_process_data->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;
+#endif //EXTRA_CHECK
+
+
     guint new_x;
     
     convert_time_to_pixels(
@@ -2249,17 +2274,6 @@ int before_process_hook(void *hook_data, void *call_data)
   e = tfc->e;
 
   LttTime evtime = ltt_event_time(e);
-  TimeWindow time_window = 
-    lttvwindow_get_time_window(control_flow_data->tab);
-
-  LttTime end_time = time_window.end_time;
-
-#ifdef EXTRA_CHECK
-  if(ltt_time_compare(evtime, time_window.start_time) == -1
-        || ltt_time_compare(evtime, end_time) == 1)
-            return;
-#endif //EXTRA_CHECK
-
   guint width = control_flow_data->drawing->width;
 
   guint sub_id;
@@ -2284,7 +2298,6 @@ int before_process_hook(void *hook_data, void *call_data)
     g_assert(process != NULL);
 
     birth = process->creation_time;
-    const gchar *name = g_quark_to_string(process->name);
 
     if(processlist_get_process_pixels(process_list,
             pid,
@@ -2297,6 +2310,7 @@ int before_process_hook(void *hook_data, void *call_data)
     {
       g_assert(pid == 0 || pid != process->ppid);
       /* Process not present */
+      const gchar *name = g_quark_to_string(process->name);
       ProcessInfo *process_info;
       processlist_add(process_list,
           pid,
@@ -2331,6 +2345,15 @@ int before_process_hook(void *hook_data, void *call_data)
                         evtime) > 0)
     {
       if(hashed_process_data->x.middle_marked == FALSE) {
+        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;
+#endif //EXTRA_CHECK
+
         guint x;
         convert_time_to_pixels(
                   time_window,
@@ -2347,6 +2370,15 @@ int before_process_hook(void *hook_data, void *call_data)
         hashed_process_data->x.middle_marked = TRUE;
       }
     } else {
+    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;
+#endif //EXTRA_CHECK
+
       guint x;
 
       convert_time_to_pixels(
@@ -2444,17 +2476,6 @@ int after_process_hook(void *hook_data, void *call_data)
   e = tfc->e;
 
   LttTime evtime = ltt_event_time(e);
-  TimeWindow time_window = 
-    lttvwindow_get_time_window(control_flow_data->tab);
-
-  LttTime end_time = time_window.end_time;
-
-#ifdef EXTRA_CHECK
-  if(ltt_time_compare(evtime, time_window.start_time) == -1
-        || ltt_time_compare(evtime, end_time) == 1)
-            return;
-#endif //EXTRA_CHECK
-
   guint width = control_flow_data->drawing->width;
 
   guint sub_id;
@@ -2485,7 +2506,6 @@ int after_process_hook(void *hook_data, void *call_data)
     g_assert(process_child != NULL);
 
     birth = process_child->creation_time;
-    const gchar *name = g_quark_to_string(process_child->name);
 
     if(processlist_get_process_pixels(process_list,
             child_pid,
@@ -2498,6 +2518,7 @@ int after_process_hook(void *hook_data, void *call_data)
     {
       g_assert(child_pid == 0 || child_pid != process_child->ppid);
       /* Process not present */
+      const gchar *name = g_quark_to_string(process_child->name);
       ProcessInfo *process_info;
       processlist_add(process_list,
           child_pid,
@@ -2520,6 +2541,15 @@ int after_process_hook(void *hook_data, void *call_data)
     if(ltt_time_compare(hashed_process_data_child->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;
+#endif //EXTRA_CHECK
+
       guint new_x;
       convert_time_to_pixels(
           time_window,
@@ -2559,7 +2589,6 @@ int after_process_hook(void *hook_data, void *call_data)
     g_assert(process != NULL);
 
     birth = process->creation_time;
-    const gchar *name = g_quark_to_string(process->name);
 
     if(processlist_get_process_pixels(process_list,
             pid,
@@ -2572,6 +2601,7 @@ int after_process_hook(void *hook_data, void *call_data)
     {
       g_assert(pid == 0 || pid != process->ppid);
       /* Process not present */
+      const gchar *name = g_quark_to_string(process->name);
       ProcessInfo *process_info;
       processlist_add(process_list,
           pid,
@@ -2594,6 +2624,15 @@ int after_process_hook(void *hook_data, void *call_data)
     if(ltt_time_compare(hashed_process_data->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;
+#endif //EXTRA_CHECK
+
       guint new_x;
       convert_time_to_pixels(
           time_window,
@@ -3032,17 +3071,6 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data)
   LttvTracesetContext *tsc = (LttvTracesetContext*)closure_data->tss;
 
   LttTime evtime = closure_data->end_time;
-  TimeWindow time_window = 
-    lttvwindow_get_time_window(control_flow_data->tab);
-
-  LttTime end_time = time_window.end_time;
-
-#ifdef EXTRA_CHECK
-  if(ltt_time_compare(evtime, time_window.start_time) == -1
-        || ltt_time_compare(evtime, end_time) == 1)
-            return;
-#endif //EXTRA_CHECK
-
   guint width = drawing->width;
 
   { 
@@ -3052,8 +3080,9 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data)
      * draw items from the beginning of the read for it. If it is not
      * present, it's a new process and it was not present : it will
      * be added after the state update.  */
+#ifdef EXTRA_CHECK
     g_assert(lttv_traceset_number(tsc->ts) > 0);
-
+#endif //EXTRA_CHECK
     /* tracefiles[0] is ok here, because we draw for every PID, and
      * assume CPU 0 for PID 0 //FIXME */
     LttvTracefileState *tfs =
@@ -3098,6 +3127,14 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data)
       if(ltt_time_compare(hashed_process_data->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;
+#endif //EXTRA_CHECK
         guint x;
 
         convert_time_to_pixels(
This page took 0.029117 seconds and 4 git commands to generate.