controlflow: make it work again
authorpmf <pmf@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 12 Oct 2007 23:12:19 +0000 (23:12 +0000)
committerpmf <pmf@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 12 Oct 2007 23:12:19 +0000 (23:12 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@2673 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/gui/controlflow/drawing.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/lttvwindow/lttvwindow/lttvwindow.c

index 83406014bc2431c416865dc80cdff0bf90f0db7a..24f24bd53cd847bd6b8bcc5f5d4296da60599070 100644 (file)
@@ -37,7 +37,6 @@
 #include "cfv.h"
 
 #define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
-#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
 
 //FIXME
 // fixed #define TRACE_NUMBER 0
@@ -178,12 +177,11 @@ void drawing_data_request(Drawing_t *drawing,
     LttvTraceHook *th;
 
     guint ret;
-    gint before_hn, after_hn;
+    gint first_after;
 
     nb_trace = lttv_traceset_number(traceset);
     // FIXME  (fixed) : eventually request for more traces
     for(i = 0 ; i < nb_trace ; i++) {
-    //for(i = 0; i<MIN(TRACE_NUMBER+1, nb_trace);i++) {
       EventsRequest *events_request = g_new(EventsRequest, 1);
       // Create the hooks
       //LttvHooks *event = lttv_hooks_new();
@@ -219,235 +217,176 @@ void drawing_data_request(Drawing_t *drawing,
       /* Find the eventtype id for the following events and register the
          associated by id hooks. */
 
-      hooks = g_array_new(FALSE, FALSE, sizeof(LttvTraceHook));
-      hooks = g_array_set_size(hooks, 18);
-      before_hn = after_hn = 0;
+      hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 18);
 
       /* before hooks */
       
-      ret = lttv_trace_find_hook(ts->parent.t,
+      lttv_trace_find_hook(ts->parent.t,
+          LTT_FACILITY_KERNEL_ARCH,
           LTT_EVENT_SYSCALL_ENTRY,
-          LTT_FIELD_SYSCALL_ID, 0, 0,
+          FIELD_ARRAY(LTT_FIELD_SYSCALL_ID),
           before_execmode_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
+          &hooks);
 
-      ret = lttv_trace_find_hook(ts->parent.t,
+      lttv_trace_find_hook(ts->parent.t,
+          LTT_FACILITY_KERNEL_ARCH,
           LTT_EVENT_SYSCALL_EXIT,
-          0, 0, 0,
+          NULL,
           before_execmode_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
+          &hooks);
 
-      ret = lttv_trace_find_hook(ts->parent.t,
+      lttv_trace_find_hook(ts->parent.t,
+          LTT_FACILITY_KERNEL_ARCH,
           LTT_EVENT_TRAP_ENTRY,
-          LTT_FIELD_TRAP_ID, 0, 0,
+          FIELD_ARRAY(LTT_FIELD_TRAP_ID),
           before_execmode_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
+          &hooks);
 
-      ret = lttv_trace_find_hook(ts->parent.t,
+      lttv_trace_find_hook(ts->parent.t,
+          LTT_FACILITY_KERNEL_ARCH,
           LTT_EVENT_TRAP_EXIT,
-          0, 0, 0
+          NULL
           before_execmode_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
+          &hooks);
 
-      ret = lttv_trace_find_hook(ts->parent.t,
+      lttv_trace_find_hook(ts->parent.t,
+          LTT_FACILITY_KERNEL,
           LTT_EVENT_IRQ_ENTRY,
-          LTT_FIELD_IRQ_ID, 0, 0,
+          FIELD_ARRAY(LTT_FIELD_IRQ_ID),
           before_execmode_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
+          &hooks);
 
-      ret = lttv_trace_find_hook(ts->parent.t,
+      lttv_trace_find_hook(ts->parent.t,
+          LTT_FACILITY_KERNEL,
           LTT_EVENT_IRQ_EXIT,
-          0, 0, 0, 
+          NULL,
           before_execmode_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
+          &hooks);
 
-      ret = lttv_trace_find_hook(ts->parent.t,
+      lttv_trace_find_hook(ts->parent.t,
+          LTT_FACILITY_KERNEL,
           LTT_EVENT_SOFT_IRQ_ENTRY,
-          LTT_FIELD_SOFT_IRQ_ID, 0, 0,
+          FIELD_ARRAY(LTT_FIELD_SOFT_IRQ_ID),
           before_execmode_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
+          &hooks);
 
-      ret = lttv_trace_find_hook(ts->parent.t,
+      lttv_trace_find_hook(ts->parent.t,
+          LTT_FACILITY_KERNEL,
           LTT_EVENT_SOFT_IRQ_EXIT,
-          0, 0, 0, 
+          NULL,
           before_execmode_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
+          &hooks);
 
 
-      ret = lttv_trace_find_hook(ts->parent.t,
+      lttv_trace_find_hook(ts->parent.t,
+          LTT_FACILITY_KERNEL,
           LTT_EVENT_SCHED_SCHEDULE,
-          LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE,
+          FIELD_ARRAY(LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE),
           before_schedchange_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
+          &hooks);
 
-      ret = lttv_trace_find_hook(ts->parent.t,
+      lttv_trace_find_hook(ts->parent.t,
+          LTT_FACILITY_KERNEL,
           LTT_EVENT_PROCESS_EXIT,
-          LTT_FIELD_PID, 0, 0,
+          FIELD_ARRAY(LTT_FIELD_PID),
           before_process_exit_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
+          &hooks);
       
-      ret = lttv_trace_find_hook(ts->parent.t,
+      lttv_trace_find_hook(ts->parent.t,
+          LTT_FACILITY_KERNEL,
           LTT_EVENT_PROCESS_FREE,
-          LTT_FIELD_PID, 0, 0,
+          FIELD_ARRAY(LTT_FIELD_PID),
           before_process_release_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
+          &hooks);
 
-      ret = lttv_trace_find_hook(ts->parent.t,
+      lttv_trace_find_hook(ts->parent.t,
+          LTT_FACILITY_LIST,
           LTT_EVENT_STATEDUMP_END,
-          0, 0, 0,
+          NULL,
           before_statedump_end,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
+          &hooks);
 
-#if 0
+      /* After hooks */
+      first_after = hooks->len;
       lttv_trace_find_hook(ts->parent.t,
-          "core", "process", "event_sub_id", 
-          "event_data1", "event_data2", before_process_hook,
-          &g_array_index(hooks, LttvTraceHook, hn++));
-#endif //0
-#if 0
-      lttv_trace_find_hook(ts->parent.t, "core", "process_fork", "child_pid", 
-          NULL, NULL, process_fork, &g_array_index(hooks, LttvTraceHook, hn++));
-
-      lttv_trace_find_hook(ts->parent.t, "core", "process_exit", NULL, NULL, 
-          NULL, process_exit, &g_array_index(hooks, LttvTraceHook, hn++));
-#endif //0
-
-      /* after hooks */
-      
-#if 0
-      /**** DESACTIVATED ****/
-      lttv_trace_find_hook(ts->parent.t, "core","syscall_entry","syscall_id", 
-    NULL, NULL, after_execmode_hook, &g_array_index(hooks, LttvTraceHook, hn++));
-      /**** DESACTIVATED ****/
-      lttv_trace_find_hook(ts->parent.t, "core", "syscall_exit", NULL, NULL, 
-          NULL, after_execmode_hook, &g_array_index(hooks, LttvTraceHook, hn++));
-
-      /**** DESACTIVATED ****/
-      lttv_trace_find_hook(ts->parent.t, "core", "trap_entry", "trap_id",
-    NULL, NULL, after_execmode_hook, &g_array_index(hooks, LttvTraceHook, hn++));
-
-      /**** DESACTIVATED ****/
-      lttv_trace_find_hook(ts->parent.t, "core", "trap_exit", NULL, NULL, NULL, 
-          after_execmode_hook, &g_array_index(hooks, LttvTraceHook, hn++));
-
-      /**** DESACTIVATED ****/
-      lttv_trace_find_hook(ts->parent.t, "core", "irq_entry", "irq_id", NULL, 
-          NULL, after_execmode_hook, &g_array_index(hooks, LttvTraceHook, hn++));
-
-      /**** DESACTIVATED ****/
-      lttv_trace_find_hook(ts->parent.t, "core", "irq_exit", NULL, NULL, NULL, 
-          after_execmode_hook, &g_array_index(hooks, LttvTraceHook, hn++));
-#endif //0
-#if 0
-      lttv_trace_find_hook(ts->parent.t, "core", "schedchange", "in", "out", 
-        "out_state", after_schedchange_hook, 
-        &g_array_index(hooks, LttvTraceHook, hn++));
-
-      lttv_trace_find_hook(ts->parent.t, "core", "process", "event_sub_id", 
-          "event_data1", "event_data2", after_process_hook,
-          &g_array_index(hooks, LttvTraceHook, hn++));
-#endif //0
-      after_hn = before_hn;
-      
-      ret = lttv_trace_find_hook(ts->parent.t,
+          LTT_FACILITY_KERNEL,
           LTT_EVENT_SCHED_SCHEDULE,
-          LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE,
+          FIELD_ARRAY(LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE),
           after_schedchange_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, after_hn++));
-      if(ret) after_hn--;
+          &hooks);
 
-      ret = lttv_trace_find_hook(ts->parent.t,
+      lttv_trace_find_hook(ts->parent.t,
+          LTT_FACILITY_KERNEL,
           LTT_EVENT_PROCESS_FORK,
-          LTT_FIELD_PARENT_PID, LTT_FIELD_CHILD_PID, 0,
+          FIELD_ARRAY(LTT_FIELD_PARENT_PID, LTT_FIELD_CHILD_PID),
           after_process_fork_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, after_hn++));
-      if(ret) after_hn--;
+          &hooks);
 
-      ret = lttv_trace_find_hook(ts->parent.t,
+      lttv_trace_find_hook(ts->parent.t,
+          LTT_FACILITY_KERNEL,
           LTT_EVENT_PROCESS_EXIT,
-          LTT_FIELD_PID, 0, 0,
+          FIELD_ARRAY(LTT_FIELD_PID),
           after_process_exit_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, after_hn++));
-      if(ret) after_hn--;
+          &hooks);
 
-      ret = lttv_trace_find_hook(ts->parent.t,
+      lttv_trace_find_hook(ts->parent.t,
+          LTT_FACILITY_KERNEL,
           LTT_EVENT_EXEC,
-          0, 0, 0,
+          NULL,
           after_fs_exec_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, after_hn++));
-      if(ret) after_hn--;
+          &hooks);
 
-      ret = lttv_trace_find_hook(ts->parent.t,
+      lttv_trace_find_hook(ts->parent.t,
+          LTT_FACILITY_USER_GENERIC,
           LTT_EVENT_THREAD_BRAND,
-          LTT_FIELD_NAME, 0, 0,
+          FIELD_ARRAY(LTT_FIELD_NAME),
           after_user_generic_thread_brand_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, after_hn++));
-      if(ret) after_hn--;
+          &hooks);
 
-      ret = lttv_trace_find_hook(ts->parent.t,
+      lttv_trace_find_hook(ts->parent.t,
+          LTT_FACILITY_LIST,
           LTT_EVENT_PROCESS_STATE,
-          LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME,
+          FIELD_ARRAY(LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME),
           after_event_enum_process_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, after_hn++));
-      if(ret) after_hn--;
-
-      hooks = g_array_set_size(hooks, after_hn);
-
-#if 0
-      lttv_trace_find_hook(ts->parent.t, "core", "process_fork", "child_pid", 
-          NULL, NULL, process_fork, &g_array_index(hooks, LttvTraceHook, hn++));
-
-      lttv_trace_find_hook(ts->parent.t, "core", "process_exit", NULL, NULL, 
-          NULL, process_exit, &g_array_index(hooks, LttvTraceHook, hn++));
-#endif //0
-
+          &hooks);
 
       
       /* Add these hooks to each event_by_id hooks list */
       /* add before */
-      for(k = 0 ; k < before_hn ; k++) {
-          lttv_hooks_add(lttv_hooks_by_id_find(event_by_id, th->id),
-                          th->h,
-                          th,
-                          LTTV_PRIO_STATE-5);
+      for(k = 0 ; k < first_after ; k++) {
+        th = &g_array_index(hooks, LttvTraceHook, k);
+        lttv_hooks_add(lttv_hooks_by_id_find(event_by_id, th->id),
+                        th->h,
+                        th,
+                        LTTV_PRIO_STATE-5);
       }
 
       /* add after */
-      for(k = before_hn ; k < after_hn ; k++) {
-          lttv_hooks_add(lttv_hooks_by_id_find(event_by_id, th->id),
-                         th->h,
-                         th,
-                         LTTV_PRIO_STATE+5);
+      for(k = first_after ; k < hooks->len ; k++) {
+        th = &g_array_index(hooks, LttvTraceHook, k);
+        lttv_hooks_add(lttv_hooks_by_id_find(event_by_id, th->id),
+                       th->h,
+                       th,
+                       LTTV_PRIO_STATE+5);
       }
       
       events_request->hooks = hooks;
@@ -481,38 +420,8 @@ void drawing_data_request(Drawing_t *drawing,
                                          time_end.tv_nsec);
 
       lttvwindow_events_request(tab, events_request);
-
     }
-
   }
-
-#if 0
-  lttv_hooks_add(event,
-                 before_schedchange_hook,
-                 events_request,
-                 LTTV_PRIO_STATE-5);
-  lttv_hooks_add(event,
-                 after_schedchange_hook,
-                 events_request,
-                 LTTV_PRIO_STATE+5);
-  lttv_hooks_add(event,
-                 before_execmode_hook,
-                 events_request,
-                 LTTV_PRIO_STATE-5);
-  lttv_hooks_add(event,
-                 after_execmode_hook,
-                 events_request,
-                 LTTV_PRIO_STATE+5);
-  lttv_hooks_add(event,
-                 before_process_hook,
-                 events_request,
-                 LTTV_PRIO_STATE-5);
-  lttv_hooks_add(event,
-                 after_process_hook,
-                 events_request,
-                 LTTV_PRIO_STATE+5);
-#endif //0
-
 }
  
 
index 53d3a8834681d7a5615662bbf6bbc34c1c5ef8bb..dc6c161716cf3739b9153a8197a2d09840d26ede 100644 (file)
@@ -362,8 +362,8 @@ int before_schedchange_hook(void *hook_data, void *call_data)
   guint pid_out;
   guint pid_in;
   {
-    pid_out = ltt_event_get_long_unsigned(e, th->f1);
-    pid_in = ltt_event_get_long_unsigned(e, th->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));
   }
   
   tfc->target_pid = pid_out;
@@ -769,8 +769,8 @@ int after_schedchange_hook(void *hook_data, void *call_data)
   guint pid_in;
   {
     guint pid_out;
-    pid_out = ltt_event_get_long_unsigned(e, th->f1);
-    pid_in = ltt_event_get_long_unsigned(e, th->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));
   }
 
 
@@ -1299,7 +1299,7 @@ int before_process_release_hook(void *hook_data, void *call_data)
 
   guint pid;
   {
-    pid = ltt_event_get_long_unsigned(e, th->f1);
+    pid = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0));
   }
 
   /* Add process to process list (if not present) */
@@ -1499,7 +1499,7 @@ int after_process_fork_hook(void *hook_data, void *call_data)
 
   guint child_pid;
   {
-    child_pid = ltt_event_get_long_unsigned(e, th->f2);
+    child_pid = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 1));
   }
 
   /* Add process to process list (if not present) */
@@ -1927,7 +1927,7 @@ int after_event_enum_process_hook(void *hook_data, void *call_data)
   
   guint pid_in;
   {
-    pid_in = ltt_event_get_long_unsigned(e, th->f1);
+    pid_in = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0));
   }
   
   if(pid_in == 0) {
index 04be3d2187f3c111b0e769546f4f2f2bf0b333a0..8d941332dbcf300f1b11b4f27958df101994e385 100644 (file)
@@ -32,7 +32,6 @@
 #include "drawitem.h"
 
 #define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
-#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
 
 /* Preallocated Size of the index_to_pixmap array */
 #define ALLOCATE_PROCESSES 1000
index 4f77d883a695173b97fc73db4e5bd834bac5bddc..5ff1c55c31f515ef7a3e1469028b61725eb80879 100644 (file)
@@ -1110,7 +1110,7 @@ void events_request_free(EventsRequest *events_request)
   if(events_request->hooks != NULL) {
     guint i;
     GArray *hooks = events_request->hooks;
-    lttv_trace_hook_remove_all(hooks);
+    lttv_trace_hook_remove_all(&hooks);
     g_array_free(events_request->hooks, TRUE);
   }
   if(events_request->before_chunk_traceset != NULL)
This page took 0.032168 seconds and 4 git commands to generate.