state.c: remove a few warnings
[lttv.git] / ltt / branches / poly / lttv / lttv / state.c
index 405c6e709175f8c376f7feda0ae89c36f5a82410..9fa85a0d8c49c506f712b76d7c3f0d4abbc8a1fc 100644 (file)
@@ -16,6 +16,7 @@
  * MA 02111-1307, USA.
  */
 
+#define _GNU_SOURCE
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 #include <lttv/lttv.h>
 #include <lttv/module.h>
 #include <lttv/state.h>
-#include <ltt/facility.h>
 #include <ltt/trace.h>
 #include <ltt/event.h>
-#include <ltt/type.h>
 #include <stdio.h>
 #include <string.h>
 
@@ -75,7 +74,8 @@ GQuark
     LTT_EVENT_FUNCTION_EXIT,
     LTT_EVENT_THREAD_BRAND,
     LTT_EVENT_REQUEST_ISSUE,
-    LTT_EVENT_REQUEST_COMPLETE;
+    LTT_EVENT_REQUEST_COMPLETE,
+    LTT_EVENT_LIST_INTERRUPT;
 
 /* Fields Quarks */
 
@@ -102,7 +102,9 @@ GQuark
     LTT_FIELD_CALL_SITE,
     LTT_FIELD_MINOR,
     LTT_FIELD_MAJOR,
-    LTT_FIELD_OPERATION;
+    LTT_FIELD_OPERATION,
+    LTT_FIELD_ACTION,
+    LTT_FIELD_NUM;
 
 LttvExecutionMode
   LTTV_STATE_MODE_UNKNOWN,
@@ -256,7 +258,7 @@ restore_init_state(LttvTraceState *self)
 {
   guint i, nb_cpus, nb_irqs;
 
-  LttvTracefileState *tfcs;
+  //LttvTracefileState *tfcs;
 
   LttTime start_time, end_time;
   
@@ -354,7 +356,7 @@ state_load_saved_states(LttvTraceState *tcs)
 {
   FILE *fp;
   GPtrArray *quarktable;
-  char *trace_path;
+  const char *trace_path;
   char path[PATH_MAX];
   guint count;
   guint i;
@@ -519,7 +521,7 @@ fini(LttvTracesetState *self)
 
   LttvTraceState *tcs;
 
-  LttvTracefileState *tfcs;
+  //LttvTracefileState *tfcs;
 
   LttvAttributeValue v;
 
@@ -607,7 +609,7 @@ static void write_process_state(gpointer key, gpointer value,
   }
 
   for(i = 0 ; i < process->user_stack->len; i++) {
-    address = &g_array_index(process->user_stack, guint64, i);
+    address = g_array_index(process->user_stack, guint64, i);
     fprintf(fp, "    <USER_STACK ADDRESS=\"%llu\"/>\n",
             address);
   }
@@ -742,7 +744,7 @@ static void write_process_state_raw(gpointer key, gpointer value,
   }
 
   for(i = 0 ; i < process->user_stack->len; i++) {
-    address = &g_array_index(process->user_stack, guint64, i);
+    address = g_array_index(process->user_stack, guint64, i);
     fputc(HDR_USER_STACK, fp);
     fwrite(&address, sizeof(address), 1, fp);
 #if 0
@@ -838,9 +840,7 @@ static void read_process_state_raw(LttvTraceState *self, FILE *fp,
   LttvProcessState tmp;
   GQuark tmpq;
 
-  guint i;
   guint64 *address;
-  guint cpu;
 
   /* TODO : check return value */
   fread(&tmp.type, sizeof(tmp.type), 1, fp);
@@ -1077,7 +1077,7 @@ void lttv_trace_states_read_raw(LttvTraceState *tcs, FILE *fp,
 end_loop:
   *(tcs->max_time_state_recomputed_in_seek) = tcs->parent.time_span.end_time;
   restore_init_state(tcs);
-  lttv_process_trace_seek_time(tcs, ltt_time_zero);
+  lttv_process_trace_seek_time(&tcs->parent, ltt_time_zero);
   return;
 }
 
@@ -1213,6 +1213,8 @@ static LttvBdevState *bdevstate_new(void)
   LttvBdevState *retval;
   retval = g_malloc(sizeof(LttvBdevState));
   retval->mode_stack = g_array_new(FALSE, FALSE, sizeof(GQuark));
+
+  return retval;
 }
 
 static void bdevstate_free(LttvBdevState *bds)
@@ -1234,15 +1236,17 @@ static LttvBdevState *bdevstate_copy(LttvBdevState *bds)
 
   retval = bdevstate_new();
   g_array_insert_vals(retval->mode_stack, 0, bds->mode_stack->data, bds->mode_stack->len);
+
+  return retval;
 }
 
 static void insert_and_copy_bdev_state(gpointer k, gpointer v, gpointer u)
 {
-  GHashTable *ht = (GHashTable *)u;
+  //GHashTable *ht = (GHashTable *)u;
   LttvBdevState *bds = (LttvBdevState *)v;
   LttvBdevState *newbds;
 
-  newbds = bdevstate_copy(v);
+  newbds = bdevstate_copy(bds);
 
   g_hash_table_insert(u, k, newbds);
 }
@@ -1283,12 +1287,8 @@ static void state_save(LttvTraceState *self, LttvAttribute *container)
   
   guint *running_process;
 
-  LttvAttributeType type;
-
   LttvAttributeValue value;
 
-  LttvAttributeName name;
-
   LttEventPosition *ep;
 
   tracefiles_tree = lttv_attribute_find_subdir(container, 
@@ -1350,7 +1350,6 @@ static void state_save(LttvTraceState *self, LttvAttribute *container)
 
   /* save the cpu state */
   {
-    guint size = sizeof(LttvCPUState)*nb_cpus;
     value = lttv_attribute_add(container, LTTV_STATE_RESOURCE_CPUS,
         LTTV_POINTER);
     *(value.v_pointer) = lttv_state_copy_cpu_states(self->cpu_states, nb_cpus);
@@ -1359,7 +1358,6 @@ static void state_save(LttvTraceState *self, LttvAttribute *container)
   /* save the irq state */
   nb_irqs = self->nb_irqs;
   {
-    guint size = sizeof(LttvCPUState)*nb_irqs;
     value = lttv_attribute_add(container, LTTV_STATE_RESOURCE_IRQS,
         LTTV_POINTER);
     *(value.v_pointer) = lttv_state_copy_irq_states(self->irq_states, nb_irqs);
@@ -1437,7 +1435,7 @@ static void state_restore(LttvTraceState *self, LttvAttribute *container)
   type = lttv_attribute_get_by_name(container, LTTV_STATE_RESOURCE_BLKDEVS, &value);
   g_assert(type == LTTV_POINTER);
   lttv_state_free_blkdev_hashtable(self->bdev_states);
-  self->bdev_states = lttv_state_copy_blkdev_hashtable(self->bdev_states);
+  self->bdev_states = lttv_state_copy_blkdev_hashtable(*(value.v_pointer));
 
   for(i = 0 ; i < nb_tracefile ; i++) {
     tfcs = 
@@ -1496,8 +1494,6 @@ static void state_saved_free(LttvTraceState *self, LttvAttribute *container)
 
   gboolean is_named;
 
-  LttEventPosition *ep;
-
   tracefiles_tree = lttv_attribute_find_subdir(container, 
       LTTV_STATE_TRACEFILES);
   g_object_ref(G_OBJECT(tracefiles_tree));
@@ -1653,7 +1649,7 @@ create_name_tables(LttvTraceState *tcs)
   }
 #endif //0
   if(!lttv_trace_find_hook(tcs->parent.t,
-      LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_ENTRY,
+      LTT_EVENT_SYSCALL_ENTRY,
       LTT_FIELD_SYSCALL_ID, 0, 0,
       NULL, NULL, &h)) {
     
@@ -2364,6 +2360,24 @@ static gboolean soft_irq_entry(void *hook_data, void *call_data)
   return FALSE;
 }
 
+static gboolean enum_interrupt(void *hook_data, void *call_data)
+{
+  LttvTracefileState *s = (LttvTracefileState *)call_data;
+  LttvTraceState *ts = (LttvTraceState *)s->parent.t_context;
+  LttEvent *e = ltt_tracefile_get_event(s->parent.tf);
+  guint8 fac_id = ltt_event_facility_id(e);
+  guint8 ev_id = ltt_event_eventtype_id(e);
+  LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data;
+
+  GQuark action = g_quark_from_string(ltt_event_get_string(e, thf->f1));
+  guint irq = ltt_event_get_long_unsigned(e, thf->f2);
+
+  ts->irq_names[irq] = action;
+
+  return FALSE;
+}
+
+
 static gboolean bdev_request_issue(void *hook_data, void *call_data)
 {
   LttvTracefileState *s = (LttvTracefileState *)call_data;
@@ -3169,6 +3183,12 @@ void lttv_state_add_event_hooks(LttvTracesetState *self)
         statedump_end, NULL, &g_array_index(hooks, LttvTraceHook, hn++));
     if(ret) hn--;
 
+    ret = lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_LIST, LTT_EVENT_LIST_INTERRUPT,
+        LTT_FIELD_ACTION, LTT_FIELD_NUM, 0,
+        enum_interrupt, NULL, &g_array_index(hooks, LttvTraceHook, hn++));
+    if(ret) hn--;
+
     ret = lttv_trace_find_hook(ts->parent.t,
         LTT_FACILITY_BLOCK, LTT_EVENT_REQUEST_ISSUE,
         LTT_FIELD_MAJOR, LTT_FIELD_MINOR, LTT_FIELD_OPERATION,
@@ -3896,6 +3916,7 @@ static void module_init()
   LTT_EVENT_THREAD_BRAND  = g_quark_from_string("thread_brand");
   LTT_EVENT_REQUEST_ISSUE = g_quark_from_string("_blk_request_issue");
   LTT_EVENT_REQUEST_COMPLETE = g_quark_from_string("_blk_request_complete");
+  LTT_EVENT_LIST_INTERRUPT = g_quark_from_string("interrupt");;
 
 
   LTT_FIELD_SYSCALL_ID    = g_quark_from_string("syscall_id");
@@ -3921,6 +3942,8 @@ static void module_init()
   LTT_FIELD_MAJOR     = g_quark_from_string("major");
   LTT_FIELD_MINOR     = g_quark_from_string("minor");
   LTT_FIELD_OPERATION     = g_quark_from_string("direction");
+  LTT_FIELD_ACTION        = g_quark_from_string("action");
+  LTT_FIELD_NUM           = g_quark_from_string("num");
   
   LTTV_CPU_UNKNOWN = g_quark_from_string("unknown");
   LTTV_CPU_IDLE = g_quark_from_string("idle");
This page took 0.026761 seconds and 4 git commands to generate.