Remove more warnings in the GUI modules
[lttv.git] / lttv / modules / gui / controlflow / drawing.c
index 3d74b502043d2797e3b5f3c6bb8d4d85495bd080..cf3881b091f3bb0c417d22e17acef5e61bf9d3c6 100644 (file)
 #include <gdk/gdk.h>
 #include <string.h>
 
-#include <ltt/trace.h>
-
 #include <lttv/lttv.h>
-#include <lttv/tracecontext.h>
 #include <lttvwindow/lttvwindow.h>
 #include <lttv/state.h>
 #include <lttv/hook.h>
@@ -125,8 +122,11 @@ void drawing_data_request(Drawing_t *drawing,
 
 
   Tab *tab = drawing->control_flow_data->tab;
-  TimeWindow time_window =
-              lttvwindow_get_time_window(tab);
+  TimeWindow time_window = lttvwindow_get_time_window(tab);
+  LttvTraceset *traceset = lttvwindow_get_traceset(tab);
+  if(lttv_traceset_number(traceset) <= 0){
+    return;
+  }
 
   ControlFlowData *control_flow_data = drawing->control_flow_data;
   //    (ControlFlowData*)g_object_get_data(
@@ -160,23 +160,39 @@ void drawing_data_request(Drawing_t *drawing,
                                        control_flow_data);
 
   {
-    /* find the tracehooks */
-    LttvTracesetContext *tsc = lttvwindow_get_traceset_context(tab);
-
-    LttvTraceset *traceset = tsc->ts;
-
-    guint i, k, l, nb_trace;
-
-    LttvTraceState *ts;
-
-    LttvTracefileState *tfs;
-
-    GArray *hooks;
-
-    LttvTraceHook *th;
-
-    guint ret;
-    gint first_after;
+        LttvHooks *event_hook = lttv_hooks_new();
+       g_assert(event_hook);
+       lttv_hooks_add(event_hook,before_execmode_hook , control_flow_data, LTTV_PRIO_STATE-5);
+   #ifdef BABEL_CLEANUP     
+       lttv_hooks_add(event_hook,syscall_exit , control_flow_data, LTTV_PRIO_STATE);
+       lttv_hooks_add(event_hook,irq_entry , control_flow_data, LTTV_PRIO_STATE);
+       lttv_hooks_add(event_hook,irq_exit , control_flow_data, LTTV_PRIO_STATE);
+       lttv_hooks_add(event_hook,soft_irq_raise , control_flow_data, LTTV_PRIO_STATE);
+       lttv_hooks_add(event_hook,soft_irq_entry , control_flow_data, LTTV_PRIO_STATE);
+       lttv_hooks_add(event_hook,soft_irq_exit , control_flow_data, LTTV_PRIO_STATE);
+#endif //babel_cleanup
+       lttv_hooks_add(event_hook,before_schedchange_hook , control_flow_data, LTTV_PRIO_STATE-5);      
+#ifdef BABEL_CLEANUP
+       lttv_hooks_add(event_hook,sched_try_wakeup , control_flow_data, LTTV_PRIO_STATE);       
+       lttv_hooks_add(event_hook,process_exit , control_flow_data, LTTV_PRIO_STATE);   
+       lttv_hooks_add(event_hook,process_free , control_flow_data, LTTV_PRIO_STATE);   
+       lttv_hooks_add(event_hook,process_exec , control_flow_data, LTTV_PRIO_STATE);   
+       lttv_hooks_add(event_hook,enum_process_state , control_flow_data, LTTV_PRIO_STATE);     
+       lttv_hooks_add(event_hook,statedump_end , control_flow_data, LTTV_PRIO_STATE);  
+       lttv_hooks_add(event_hook,enum_interrupt , control_flow_data, LTTV_PRIO_STATE);
+#endif //babel_cleanup
+       lttv_hooks_add(event_hook, before_trywakeup_hook, control_flow_data, LTTV_PRIO_STATE-5);
+       lttv_hooks_add(event_hook, before_process_exit_hook, control_flow_data, LTTV_PRIO_STATE-5);
+       lttv_hooks_add(event_hook, before_process_release_hook, control_flow_data, LTTV_PRIO_STATE-5);
+       lttv_hooks_add(event_hook, before_statedump_end, control_flow_data, LTTV_PRIO_STATE-5);     
+
+       lttv_hooks_add(event_hook, after_schedchange_hook, control_flow_data, LTTV_PRIO_STATE+5);
+       lttv_hooks_add(event_hook, after_process_fork_hook, control_flow_data, LTTV_PRIO_STATE+5);
+       lttv_hooks_add(event_hook, after_process_exit_hook, control_flow_data, LTTV_PRIO_STATE+5);
+       lttv_hooks_add(event_hook, after_event_enum_process_hook, control_flow_data, LTTV_PRIO_STATE+5);
+
+    guint i, nb_trace;
 
     nb_trace = lttv_traceset_number(traceset);
     // FIXME  (fixed) : eventually request for more traces
@@ -184,8 +200,7 @@ void drawing_data_request(Drawing_t *drawing,
       EventsRequest *events_request = g_new(EventsRequest, 1);
       // Create the hooks
       //LttvHooks *event = lttv_hooks_new();
-      LttvHooksByIdChannelArray *event_by_id_channel =
-          lttv_hooks_by_id_channel_new();
+
       LttvHooks *before_chunk_traceset = lttv_hooks_new();
       LttvHooks *after_chunk_traceset = lttv_hooks_new();
       LttvHooks *before_request_hook = lttv_hooks_new();
@@ -212,219 +227,6 @@ void drawing_data_request(Drawing_t *drawing,
                      LTTV_PRIO_DEFAULT);
 
 
-      ts = (LttvTraceState *)tsc->traces[i];
-
-      /* Find the eventtype id for the following events and register the
-         associated by id hooks. */
-
-      hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 18);
-
-      /* before hooks */
-      
-      lttv_trace_find_hook(ts->parent.t,
-          LTT_CHANNEL_KERNEL,
-          LTT_EVENT_SYSCALL_ENTRY,
-          FIELD_ARRAY(LTT_FIELD_SYSCALL_ID),
-          before_execmode_hook,
-          events_request,
-          &hooks);
-
-      lttv_trace_find_hook(ts->parent.t,
-          LTT_CHANNEL_KERNEL,
-          LTT_EVENT_SYSCALL_EXIT,
-          NULL,
-          before_execmode_hook,
-          events_request,
-          &hooks);
-
-      lttv_trace_find_hook(ts->parent.t,
-          LTT_CHANNEL_KERNEL,
-          LTT_EVENT_TRAP_ENTRY,
-          FIELD_ARRAY(LTT_FIELD_TRAP_ID),
-          before_execmode_hook,
-          events_request,
-          &hooks);
-
-      lttv_trace_find_hook(ts->parent.t,
-          LTT_CHANNEL_KERNEL,
-          LTT_EVENT_TRAP_EXIT,
-          NULL, 
-          before_execmode_hook,
-          events_request,
-          &hooks);
-
-      lttv_trace_find_hook(ts->parent.t,
-          LTT_CHANNEL_KERNEL,
-          LTT_EVENT_PAGE_FAULT_ENTRY,
-          FIELD_ARRAY(LTT_FIELD_TRAP_ID),
-          before_execmode_hook,
-          events_request,
-          &hooks);
-
-      lttv_trace_find_hook(ts->parent.t,
-          LTT_CHANNEL_KERNEL,
-          LTT_EVENT_PAGE_FAULT_EXIT,
-          NULL, 
-          before_execmode_hook,
-          events_request,
-          &hooks);
-
-      lttv_trace_find_hook(ts->parent.t,
-          LTT_CHANNEL_KERNEL,
-          LTT_EVENT_PAGE_FAULT_NOSEM_ENTRY,
-          FIELD_ARRAY(LTT_FIELD_TRAP_ID),
-          before_execmode_hook,
-          events_request,
-          &hooks);
-
-      lttv_trace_find_hook(ts->parent.t,
-          LTT_CHANNEL_KERNEL,
-          LTT_EVENT_PAGE_FAULT_NOSEM_EXIT,
-          NULL, 
-          before_execmode_hook,
-          events_request,
-          &hooks);
-
-      lttv_trace_find_hook(ts->parent.t,
-          LTT_CHANNEL_KERNEL,
-          LTT_EVENT_IRQ_ENTRY,
-          FIELD_ARRAY(LTT_FIELD_IRQ_ID),
-          before_execmode_hook,
-          events_request,
-          &hooks);
-
-      lttv_trace_find_hook(ts->parent.t,
-          LTT_CHANNEL_KERNEL,
-          LTT_EVENT_IRQ_EXIT,
-          NULL,
-          before_execmode_hook,
-          events_request,
-          &hooks);
-
-      lttv_trace_find_hook(ts->parent.t,
-          LTT_CHANNEL_KERNEL,
-          LTT_EVENT_SOFT_IRQ_ENTRY,
-          FIELD_ARRAY(LTT_FIELD_SOFT_IRQ_ID),
-          before_execmode_hook,
-          events_request,
-          &hooks);
-
-      lttv_trace_find_hook(ts->parent.t,
-          LTT_CHANNEL_KERNEL,
-          LTT_EVENT_SOFT_IRQ_EXIT,
-          NULL,
-          before_execmode_hook,
-          events_request,
-          &hooks);
-
-
-      lttv_trace_find_hook(ts->parent.t,
-          LTT_CHANNEL_KERNEL,
-          LTT_EVENT_SCHED_SCHEDULE,
-          FIELD_ARRAY(LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE),
-          before_schedchange_hook,
-          events_request,
-          &hooks);
-
-      lttv_trace_find_hook(ts->parent.t,
-          LTT_CHANNEL_KERNEL,
-          LTT_EVENT_PROCESS_EXIT,
-          FIELD_ARRAY(LTT_FIELD_PID),
-          before_process_exit_hook,
-          events_request,
-          &hooks);
-      
-      lttv_trace_find_hook(ts->parent.t,
-          LTT_CHANNEL_KERNEL,
-          LTT_EVENT_PROCESS_FREE,
-          FIELD_ARRAY(LTT_FIELD_PID),
-          before_process_release_hook,
-          events_request,
-          &hooks);
-
-      lttv_trace_find_hook(ts->parent.t,
-          LTT_CHANNEL_GLOBAL_STATE,
-          LTT_EVENT_STATEDUMP_END,
-          NULL,
-          before_statedump_end,
-          events_request,
-          &hooks);
-
-      /* After hooks */
-      first_after = hooks->len;
-      lttv_trace_find_hook(ts->parent.t,
-          LTT_CHANNEL_KERNEL,
-          LTT_EVENT_SCHED_SCHEDULE,
-          FIELD_ARRAY(LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE),
-          after_schedchange_hook,
-          events_request,
-          &hooks);
-
-      lttv_trace_find_hook(ts->parent.t,
-          LTT_CHANNEL_KERNEL,
-          LTT_EVENT_PROCESS_FORK,
-          FIELD_ARRAY(LTT_FIELD_PARENT_PID, LTT_FIELD_CHILD_PID),
-          after_process_fork_hook,
-          events_request,
-          &hooks);
-
-      lttv_trace_find_hook(ts->parent.t,
-          LTT_CHANNEL_KERNEL,
-          LTT_EVENT_PROCESS_EXIT,
-          FIELD_ARRAY(LTT_FIELD_PID),
-          after_process_exit_hook,
-          events_request,
-          &hooks);
-
-      lttv_trace_find_hook(ts->parent.t,
-          LTT_CHANNEL_FS,
-          LTT_EVENT_EXEC,
-          NULL,
-          after_fs_exec_hook,
-          events_request,
-          &hooks);
-
-      lttv_trace_find_hook(ts->parent.t,
-          LTT_CHANNEL_USERSPACE,
-          LTT_EVENT_THREAD_BRAND,
-          FIELD_ARRAY(LTT_FIELD_NAME),
-          after_user_generic_thread_brand_hook,
-          events_request,
-          &hooks);
-
-      lttv_trace_find_hook(ts->parent.t,
-          LTT_CHANNEL_TASK_STATE,
-          LTT_EVENT_PROCESS_STATE,
-          FIELD_ARRAY(LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME),
-          after_event_enum_process_hook,
-          events_request,
-          &hooks);
-
-      
-      /* Add these hooks to each event_by_id_channel hooks list */
-      /* add before */
-      for(k = 0 ; k < first_after ; k++) {
-        th = &g_array_index(hooks, LttvTraceHook, k);
-        lttv_hooks_add(lttv_hooks_by_id_channel_find(event_by_id_channel,
-                                                    th->channel, th->id),
-                        th->h,
-                        th,
-                        LTTV_PRIO_STATE-5);
-      }
-
-      /* add after */
-      for(k = first_after ; k < hooks->len ; k++) {
-        th = &g_array_index(hooks, LttvTraceHook, k);
-        lttv_hooks_add(lttv_hooks_by_id_channel_find(event_by_id_channel,
-                                                    th->channel, th->id),
-                       th->h,
-                       th,
-                       LTTV_PRIO_STATE+5);
-      }
-      
-      events_request->hooks = hooks;
-
       // Fill the events request
       events_request->owner = control_flow_data;
       events_request->viewer_data = control_flow_data;
@@ -439,8 +241,7 @@ void drawing_data_request(Drawing_t *drawing,
       events_request->before_chunk_traceset = before_chunk_traceset;
       events_request->before_chunk_trace = NULL;
       events_request->before_chunk_tracefile = NULL;
-      events_request->event = NULL;
-      events_request->event_by_id_channel = event_by_id_channel;
+      events_request->event = event_hook;
       events_request->after_chunk_tracefile = NULL;
       events_request->after_chunk_trace = NULL;
       events_request->after_chunk_traceset = after_chunk_traceset;
@@ -455,13 +256,14 @@ void drawing_data_request(Drawing_t *drawing,
 
       lttvwindow_events_request(tab, events_request);
     }
-  }
+  
+
+}
 }
  
 
 static void set_last_start(gpointer key, gpointer value, gpointer user_data)
 {
-  ProcessInfo *process_info = (ProcessInfo*)key;
   HashedProcessData *hashed_process_data = (HashedProcessData*)value;
   guint x = GPOINTER_TO_UINT(user_data);
 
@@ -478,12 +280,10 @@ static void set_last_start(gpointer key, gpointer value, gpointer user_data)
 
   return;
 }
-
-void drawing_data_request_begin(EventsRequest *events_request, LttvTracesetState *tss)
+void drawing_data_request_begin(EventsRequest *events_request)
 {
   g_debug("Begin of data request");
   ControlFlowData *cfd = events_request->viewer_data;
-  LttvTracesetContext *tsc = LTTV_TRACESET_CONTEXT(tss);
   TimeWindow time_window = 
     lttvwindow_get_time_window(cfd->tab);
 
@@ -502,21 +302,18 @@ void drawing_data_request_begin(EventsRequest *events_request, LttvTracesetState
                       GUINT_TO_POINTER(x));
 
 }
-
-void drawing_chunk_begin(EventsRequest *events_request, LttvTracesetState *tss)
+void drawing_chunk_begin(EventsRequest *events_request, LttvTraceset *ts)
 {
   g_debug("Begin of chunk");
   ControlFlowData *cfd = events_request->viewer_data;
-  LttvTracesetContext *tsc = &tss->parent.parent;
   //LttTime current_time = lttv_traceset_context_get_current_tfc(tsc)->timestamp;
   guint i;
-  LttvTraceset *traceset = tsc->ts;
-  guint nb_trace = lttv_traceset_number(traceset);
+  guint nb_trace = lttv_traceset_number(ts);
   
   if(!cfd->process_list->current_hash_data) {
     cfd->process_list->current_hash_data = g_new(HashedProcessData**,nb_trace);
     for(i = 0 ; i < nb_trace ; i++) {
-      guint num_cpu = ltt_trace_get_num_cpu(tss->parent.traces[i]->t);
+      guint num_cpu = lttv_trace_get_num_cpu( lttv_traceset_get(ts, i));
       cfd->process_list->current_hash_data[i] = g_new(HashedProcessData*,num_cpu);
       memset(cfd->process_list->current_hash_data[i], 0,
              sizeof(HashedProcessData*)*num_cpu);
@@ -528,18 +325,15 @@ void drawing_chunk_begin(EventsRequest *events_request, LttvTracesetState *tss)
 
 
 void drawing_request_expose(EventsRequest *events_request,
-                            LttvTracesetState *tss,
                             LttTime end_time)
 {
   gint x, width;
   guint x_end;
 
   ControlFlowData *cfd = events_request->viewer_data;
-  LttvTracesetContext *tsc = (LttvTracesetContext*)tss;
   Drawing_t *drawing = cfd->drawing;
   
-  TimeWindow time_window = 
-        lttvwindow_get_time_window(cfd->tab);
+  TimeWindow time_window = lttvwindow_get_time_window(cfd->tab);
 
   g_debug("request expose");
   
@@ -564,7 +358,6 @@ void drawing_request_expose(EventsRequest *events_request,
       TRUE);
 }
 
-
 /* Callbacks */
 
 
@@ -617,7 +410,7 @@ configure_event( GtkWidget *widget, GdkEventConfigure *event,
                          drawing->alloc_width);
       update_index_to_pixmap(drawing->control_flow_data->process_list);
     }
-    //drawing->height = widget->allocation.height;
+    drawing->height = widget->allocation.height;
 
     //ProcessList_get_height
     // (GuiControlFlow_get_process_list(drawing->control_flow_data)),
@@ -1271,20 +1064,7 @@ void drawing_remove_square(Drawing_t *drawing,
 
 void drawing_update_ruler(Drawing_t *drawing, TimeWindow *time_window)
 {
-  GtkRequisition req;
-  GdkRectangle rect;
-  
-  req.width = drawing->ruler->allocation.width;
-  req.height = drawing->ruler->allocation.height;
-
-  rect.x = 0;
-  rect.y = 0;
-  rect.width = req.width;
-  rect.height = req.height;
-
   gtk_widget_queue_draw(drawing->ruler);
-  //gtk_widget_draw( drawing->ruler, &rect);
 }
 
 /* Redraw the ruler */
This page took 0.02635 seconds and 4 git commands to generate.