unfinished conversion of gui modules
[lttv.git] / ltt / branches / poly / lttv / modules / gui / resourceview / eventhooks.c
index 4d30a4bf457f1752a1f804367c93fa7be2675708..945cc62221ca085df25164fee826a83820440381 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>
@@ -364,7 +363,7 @@ static void irq_set_line_color(PropertiesLine *prop_line, LttvIRQState *s)
 static void bdev_set_line_color(PropertiesLine *prop_line, LttvBdevState *s)
 {
   GQuark present_state;
-  if(s->mode_stack->len == 0)
+  if(s == 0 || s->mode_stack->len == 0)
     present_state = LTTV_BDEV_UNKNOWN;
   else
     present_state = ((GQuark*)s->mode_stack->data)[s->mode_stack->len-1];
@@ -403,8 +402,8 @@ static void bdev_set_line_color(PropertiesLine *prop_line, LttvBdevState *s)
 
 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;
@@ -428,8 +427,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, thf->f1);
-  pid_in = ltt_event_get_long_unsigned(e, thf->f2);
+  pid_out = ltt_event_get_long_unsigned(e, th->f1);
+  pid_in = ltt_event_get_long_unsigned(e, th->f2);
 //  if(pid_in != 0 && pid_out != 0) {
 //    /* not a transition to/from idle */
 //    return 0;
@@ -548,7 +547,6 @@ int before_schedchange_hook(void *hook_data, void *call_data)
                   width,
                   &x);
 
-
         /* Jump over draw if we are at the same x position */
         if(x == hashed_process_data->x.middle &&
              hashed_process_data->x.middle_used)
@@ -816,8 +814,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;
@@ -850,8 +848,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, thf->f1);
-    pid_in = ltt_event_get_long_unsigned(e, thf->f2);
+    pid_out = ltt_event_get_long_unsigned(e, th->f1);
+    pid_in = ltt_event_get_long_unsigned(e, th->f2);
   }
 
 
@@ -952,8 +950,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;
@@ -1148,8 +1146,8 @@ int before_execmode_hook(void *hook_data, void *call_data)
 
 int before_execmode_hook_irq(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;
@@ -1180,7 +1178,7 @@ int before_execmode_hook_irq(void *hook_data, void *call_data)
   guint8 ev_id_exit = ltt_eventtype_id(ltt_facility_eventtype_get_by_name(ev_facility, LTT_EVENT_IRQ_EXIT));
   if(ltt_facility_name(ev_facility) == LTT_FACILITY_KERNEL &&
       ev_id_entry == ltt_event_eventtype_id(e)) {
-    irq = ltt_event_get_long_unsigned(e, thf->f1);
+    irq = ltt_event_get_long_unsigned(e, th->f1);
   }
   else if(ltt_facility_name(ev_facility) == LTT_FACILITY_KERNEL &&
       ev_id_exit == ltt_event_eventtype_id(e)) {
@@ -1192,7 +1190,7 @@ int before_execmode_hook_irq(void *hook_data, void *call_data)
 
   {
     gchar *irqstr;
-    irqstr = g_strdup_printf("IRQ %u", irq);
+    irqstr = g_strdup_printf("IRQ %llu [%s]", irq, g_quark_to_string(ts->irq_names[irq]));
     resourceq = g_quark_from_string(irqstr);
     g_free(irqstr);
   }
@@ -1359,8 +1357,8 @@ int before_execmode_hook_irq(void *hook_data, void *call_data)
 
 int before_bdev_event_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;
@@ -1382,9 +1380,9 @@ int before_bdev_event_hook(void *hook_data, void *call_data)
   /* For the pid */
 
   guint cpu = tfs->cpu;
-  guint8 major = ltt_event_get_long_unsigned(e, thf->f1);
-  guint8 minor = ltt_event_get_long_unsigned(e, thf->f2);
-  guint oper = ltt_event_get_long_unsigned(e, thf->f3);
+  guint8 major = ltt_event_get_long_unsigned(e, th->f1);
+  guint8 minor = ltt_event_get_long_unsigned(e, th->f2);
+  guint oper = ltt_event_get_long_unsigned(e, th->f3);
   gint devcode_gint = MKDEV(major,minor);
 
   {
@@ -1396,7 +1394,8 @@ int before_bdev_event_hook(void *hook_data, void *call_data)
   guint trace_num = ts->parent.index;
 
   LttvBdevState *bdev = g_hash_table_lookup(ts->bdev_states, &devcode_gint); 
-  g_assert(bdev != NULL);
+  /* the result of the lookup might be NULL. that's ok, the rest of the function
+     should understand it was not found and that its state is unknown */
 
 //  guint pid = process->pid;
 
@@ -2108,7 +2107,8 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data)
               irq_set_line_color(&prop_line, &ts->irq_states[process_info->id]);
             else if(process_info->type == 2) {
               gint devcode_gint = process_info->id;
-              LttvBdevState *bdev = g_hash_table_lookup(ts->bdev_states, &devcode_gint); 
+              LttvBdevState *bdev = g_hash_table_lookup(ts->bdev_states, &devcode_gint);
+              // the lookup may return null; bdev_set_line_color must act appropriately
               bdev_set_line_color(&prop_line, bdev);
             }
             
@@ -2281,8 +2281,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.025595 seconds and 4 git commands to generate.