uninitialized variables checked, plus O2 optimisations checked : strict aliasing...
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 9 Aug 2004 01:31:58 +0000 (01:31 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 9 Aug 2004 01:31:58 +0000 (01:31 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@685 04897980-b3bd-0310-b5e0-8ef037075253

12 files changed:
ltt/branches/poly/lttv/lttv/attribute.c
ltt/branches/poly/lttv/lttv/batchtest.c
ltt/branches/poly/lttv/lttv/main.c
ltt/branches/poly/lttv/lttv/module.c
ltt/branches/poly/lttv/lttv/option.c
ltt/branches/poly/lttv/lttv/state.c
ltt/branches/poly/lttv/lttv/state.h
ltt/branches/poly/lttv/lttv/stats.c
ltt/branches/poly/lttv/lttv/stats.h
ltt/branches/poly/lttv/lttv/tracecontext.c
ltt/branches/poly/lttv/lttv/tracecontext.h
ltt/branches/poly/lttv/lttv/traceset.c

index 0eef75b80474263f1baa9e9fa0d6c5be2eeba13d..a0d30704fd804a785575502233da8de28e6c92f7 100644 (file)
@@ -16,6 +16,7 @@
  * MA 02111-1307, USA.
  */
 
+#include <string.h>
 #include <lttv/attribute.h>
 #include <ltt/ltt.h>
 
@@ -55,6 +56,7 @@ LttvAttributeValue address_of_value(LttvAttributeType t, AttributeValue *v)
   case LTTV_POINTER: va.v_pointer = &v->dv_pointer; break;
   case LTTV_STRING: va.v_string = &v->dv_string; break;
   case LTTV_GOBJECT: va.v_gobject = &v->dv_gobject; break;
+  case LTTV_NONE: break;
   }
   return va;
 }
@@ -75,6 +77,7 @@ AttributeValue init_value(LttvAttributeType t)
   case LTTV_POINTER: v.dv_pointer = NULL; break;
   case LTTV_STRING: v.dv_string = NULL; break;
   case LTTV_GOBJECT: v.dv_gobject = NULL; break;
+  case LTTV_NONE: break;
   }
   return v;
 }
@@ -360,7 +363,7 @@ lttv_attribute_write_xml(LttvAttribute *self, FILE *fp, int pos, int indent)
           fprintf(fp, "TYPE=DOUBLE VALUE=%f/>\n", a->value.dv_double);
           break;
         case LTTV_TIME:
-          fprintf(fp, "TYPE=TIME SEC=%u NSEC=%u/>\n", a->value.dv_time.tv_sec,
+          fprintf(fp, "TYPE=TIME SEC=%lu NSEC=%lu/>\n", a->value.dv_time.tv_sec,
               a->value.dv_time.tv_nsec);
           break;
         case LTTV_POINTER:
@@ -386,9 +389,7 @@ lttv_attribute_write_xml(LttvAttribute *self, FILE *fp, int pos, int indent)
 void 
 lttv_attribute_read_xml(LttvAttribute *self, FILE *fp)
 {
-  int i, nb, res;
-
-  Attribute *a;
+  int res;
 
   char buffer[256], type[10];
 
@@ -437,12 +438,12 @@ lttv_attribute_read_xml(LttvAttribute *self, FILE *fp)
     }
     else if(strcmp(type, "DOUBLE") == 0) {
       value = lttv_attribute_add(self, name, LTTV_DOUBLE);
-      res = fscanf(fp, " VALUE=%f/>", value.v_double);
+      res = fscanf(fp, " VALUE=%lf/>", value.v_double);
       g_assert(res == 1);
     }
     else if(strcmp(type, "TIME") == 0) {
       value = lttv_attribute_add(self, name, LTTV_TIME);
-      res = fscanf(fp, " SEC=%u NSEC=%u/>", &(value.v_time->tv_sec), 
+      res = fscanf(fp, " SEC=%lu NSEC=%lu/>", &(value.v_time->tv_sec), 
           &(value.v_time->tv_nsec));
       g_assert(res == 2);
     }
@@ -560,7 +561,8 @@ lttv_attribute_get_type (void)
       NULL,   /* class_data */
       sizeof (LttvAttribute),
       0,      /* n_preallocs */
-      (GInstanceInitFunc) attribute_instance_init    /* instance_init */
+      (GInstanceInitFunc) attribute_instance_init,    /* instance_init */
+      NULL    /* value handling */
     };
 
     static const GInterfaceInfo iattribute_info = {
index 08922fd738d8fb07a8327bbcc6ce54550edb8a8b..ab50262c708de894bb146ee0551d6bd2aada09d1 100644 (file)
@@ -19,7 +19,7 @@
 /* This module inserts a hook in the program main loop. This hook processes 
    all the events in the main tracefile while testing the speed and
    functionality of the state and stats computations. */
-
+#include <string.h>
 
 #include <lttv/lttv.h>
 #include <lttv/attribute.h>
@@ -32,6 +32,9 @@
 #include <ltt/trace.h>
 #include <ltt/event.h>
 #include <ltt/type.h>
+#include <ltt/facility.h>
+
+#define __UNUSED__ __attribute__((__unused__))
 
 static LttvTraceset *traceset;
 
@@ -84,7 +87,7 @@ typedef struct _save_state {
 } SaveState;
 
 
-static void lttv_trace_option(void *hook_data)
+static void lttv_trace_option(void __UNUSED__ *hook_data)
 { 
   LttTrace *trace;
 
@@ -105,7 +108,7 @@ static double run_one_test(LttvTracesetState *ts, LttTime start, LttTime end)
 {
   double t0, t1;
 
-  int i;
+  unsigned int i;
 
   //lttv_traceset_context_add_hooks(&ts->parent,
   //before_traceset, after_traceset, NULL, before_trace, after_trace,
@@ -144,7 +147,7 @@ static double run_one_test(LttvTracesetState *ts, LttTime start, LttTime end)
 }
 
 
-gboolean trace_event(void *hook_data, void *call_data)
+gboolean trace_event(void __UNUSED__ *hook_data, void *call_data)
 {
   LttvTracefileState *tfs = (LttvTracefileState *)call_data;
 
@@ -154,7 +157,7 @@ gboolean trace_event(void *hook_data, void *call_data)
 
   ltt_event_position(tfs->parent.e, a_event_position);
   ltt_event_position_get(a_event_position, &nb_block, &nb_event, &tf);
-  fprintf(stderr,"Event %s %lu.%09lu [%lu %lu]\n",
+  fprintf(stderr,"Event %s %lu.%09lu [%u %u]\n",
       ltt_eventtype_name(ltt_event_eventtype(tfs->parent.e)),
       tfs->parent.timestamp.tv_sec, tfs->parent.timestamp.tv_nsec,
       nb_block, nb_event);
@@ -162,7 +165,7 @@ gboolean trace_event(void *hook_data, void *call_data)
 }
 
 
-gboolean count_event(void *hook_data, void *call_data)
+gboolean count_event(void *hook_data, void __UNUSED__ *call_data)
 {
   guint *pcount = (guint *)hook_data;
 
@@ -173,7 +176,7 @@ gboolean count_event(void *hook_data, void *call_data)
 
 gboolean save_state_copy_event(void *hook_data, void *call_data)
 {
-  SaveState *save_state = (SaveState *)hook_data;
+  SaveState __UNUSED__ *save_state = (SaveState *)hook_data;
 
   LttvTracefileState *tfs = (LttvTracefileState *)call_data;
 
@@ -233,7 +236,8 @@ gboolean save_state_event(void *hook_data, void *call_data)
 }
 
 
-static gboolean process_traceset(void *hook_data, void *call_data)
+static gboolean process_traceset(void __UNUSED__ *hook_data, 
+                                 void __UNUSED__ *call_data)
 {
   LttvTracesetStats *tscs;
 
@@ -257,13 +261,14 @@ static gboolean process_traceset(void *hook_data, void *call_data)
 
   LttFacility *facility;
 
-  LttType *type;
-
   LttEventType *event_type;
 
   LttTime time, previous_time;
 
-  long long unsigned cycle_count, start_count, delta_cycle;
+  /* start_count is always initialized in this function _if_ there is always
+   * a block_start before a block_end.
+   */
+  long long unsigned cycle_count, start_count=0, delta_cycle;
 
   long long unsigned start_nsec, end_nsec, delta_nsec, added_nsec, added_nsec2;
 
@@ -505,10 +510,11 @@ static gboolean process_traceset(void *hook_data, void *call_data)
   /* Seek a few times to each saved position */
 
   if((a_test7 && a_test3) || a_test_all) {
-    int i, j;
-
-    for(i = 0 ; i < a_seek_number ; i++) {
-      for(j = save_state.position - 1 ; j >= 0 ; j--) {
+    g_assert(a_seek_number >= 0);
+    for(i = 0 ; i < (guint)a_seek_number ; i++) {
+      gint reverse_j; /* just to make sure j is unsigned */
+      for(reverse_j = save_state.position - 1 ; reverse_j >= 0 ; reverse_j--) {
+        j = (guint)reverse_j;
         lttv_state_add_event_hooks(ts);
         t = run_one_test(ts, save_state.write_time[j], 
             save_state.write_time[j]);
@@ -547,6 +553,7 @@ static gboolean process_traceset(void *hook_data, void *call_data)
   }
 
   g_info("BatchTest end process traceset");
+  return 0;
 }
 
 
index f984df1414c656f26557059adc4487081c1a64dd..16c0126f621ee4f2e7212c1eeff40fb929f756b6 100644 (file)
@@ -26,6 +26,7 @@
 #include <lttv/traceset.h>
 #include <ltt/trace.h>
 #include <stdio.h>
+#include <string.h>
 
 
 /* The main program maintains a few central data structures and relies
@@ -147,9 +148,9 @@ int main(int argc, char **argv) {
   GError *error = NULL;
 
   LttvModule *module_module = lttv_module_require("module", &error);
-  if(error != NULL) g_error(error->message);
+  if(error != NULL) g_error("%s", error->message);
   LttvModule *module_option = lttv_module_require("option", &error);
-  if(error != NULL) g_error(error->message);
+  if(error != NULL) g_error("%s", error->message);
 
   /* Initialize the module loading */
 
@@ -237,7 +238,7 @@ void lttv_module_option(void *hook_data)
   GError *error = NULL;
 
   lttv_module_require(a_module, &error);
-  if(error != NULL) g_error(error->message);
+  if(error != NULL) g_error("%s", error->message);
 }
 
 
index c2cc8fac72b1832979c45582b9c3114fe3ab2398..a1826b91430e2255396d4f6a9f82278bc8c0772f 100644 (file)
@@ -70,7 +70,7 @@ static GQuark lttv_module_error;
 
 static void init();
 
-static finish_destroy();
+static void finish_destroy();
 
 static void module_release(LttvModule *m);
 
@@ -129,16 +129,17 @@ static void library_remove(LttvLibrary *l)
   LttvModule *m;
 
   GPtrArray *modules;
-
+  GPtrArray **modules_ptr = &modules; /* for strict aliasing */
   guint i;
 
   char *key;
+  char **key_ptr = &key; /* for strict aliasing */
 
   for(i = 0 ; i < l->modules->len ; i++) {
     m = (LttvModule *)(l->modules->pdata[i]);
 
     g_hash_table_lookup_extended(modules_by_name, m->info.name, 
-                                (gpointer *)&key, (gpointer *)&modules);
+                                (gpointer *)key_ptr, (gpointer *)modules_ptr);
     g_assert(modules != NULL);
     g_ptr_array_remove(modules, m);
     if(modules->len == 0) {
@@ -162,11 +163,12 @@ static void library_remove(LttvLibrary *l)
 
 static LttvLibrary *library_load(char *name, GError **error)
 {
-  GModule *gm;
+  GModule *gm = NULL;
 
   int i, nb;
 
-  char *path, *pathname;
+  /* path is always initialized, checked */
+  char *path = NULL, *pathname;
 
   LttvLibrary *l;
 
@@ -234,7 +236,7 @@ LttvLibrary *lttv_library_load(char *name, GError **error)
 
 static void library_unload(LttvLibrary *l)
 {
-  guint i, len;
+  guint i;
 
   GModule *gm;
 
@@ -522,7 +524,7 @@ static void init()
 }
 
 
-static finish_destroy()
+static void finish_destroy()
 {
   guint i;
 
index 54af7932a531d3cf8e5c63c1b2522a97d5964591..f4b34275af4f9097bc74c9a0d7fd09fb6c80dc44 100644 (file)
@@ -107,7 +107,7 @@ static int poptToLTT[] = {
   POPT_ARG_NONE, POPT_ARG_STRING, POPT_ARG_INT, POPT_ARG_LONG
 };
 
-static struct poptOption endOption = { NULL, '\0', 0, NULL, 0};
+static struct poptOption endOption = { NULL, '\0', 0, NULL, 0, NULL, NULL };
 
 
 static void 
@@ -134,15 +134,15 @@ build_popts(GPtrArray **plist, struct poptOption **ppopts, poptContext *pc,
 
   /* add the options in the reverse order, so last additions are parsed first */
   for(i = 0 ; i < list->len ; i++) {
-    guint index = list->len-1-i;
+    guint reverse_i = list->len-1-i;
     option = (LttvOption *)list->pdata[i];
-    popts[index].longName = option->long_name;
-    popts[index].shortName = option->char_name;
-    popts[index].descrip = option->description;
-    popts[index].argDescrip = option->arg_description;
-    popts[index].argInfo = poptToLTT[option->t];
-    popts[index].arg = option->p;
-    popts[index].val = option->val;
+    popts[reverse_i].longName = option->long_name;
+    popts[reverse_i].shortName = option->char_name;
+    popts[reverse_i].descrip = option->description;
+    popts[reverse_i].argDescrip = option->arg_description;
+    popts[reverse_i].argInfo = poptToLTT[option->t];
+    popts[reverse_i].arg = option->p;
+    popts[reverse_i].val = option->val;
   }
 
   /* Terminate the array for popt and create the context */
@@ -271,11 +271,9 @@ static void show_help(LttvOption *option)
 
 void lttv_option_show_help(void)
 {
-       LttvOption option;
-
   GPtrArray *list = g_ptr_array_new();
 
-  int i;
+  guint i;
 
   g_hash_table_foreach(options, list_options, list);
 
@@ -286,8 +284,6 @@ void lttv_option_show_help(void)
     show_help((LttvOption *)list->pdata[i]);
   }
   g_ptr_array_free(list, TRUE);
-
-
 }
 
 static void init()
@@ -299,11 +295,9 @@ static void init()
 
 static void destroy()
 {
-  LttvOption option;
-
   GPtrArray *list = g_ptr_array_new();
 
-  int i;
+  guint i;
 
   g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "Destroy option.c");
   g_hash_table_foreach(options, list_options, list);
index e7f23f9cd04ca22c0384bc2f924c6606c12bbcb5..aa204e8a01d89a4145b44ac585bee5908a1605e6 100644 (file)
@@ -96,16 +96,16 @@ void lttv_state_state_saved_free(LttvTraceState *self,
 
 guint process_hash(gconstpointer key) 
 {
-  return ((LttvProcessState *)key)->pid;
+  return ((const LttvProcessState *)key)->pid;
 }
 
 
 gboolean process_equal(gconstpointer a, gconstpointer b)
 {
-  LttvProcessState *process_a, *process_b;
+  const LttvProcessState *process_a, *process_b;
 
-  process_a = (LttvProcessState *)a;
-  process_b = (LttvProcessState *)b;
+  process_a = (const LttvProcessState *)a;
+  process_b = (const LttvProcessState *)b;
 
   if(process_a->pid != process_b->pid) return FALSE;
   if(process_a->pid == 0 && 
@@ -188,7 +188,7 @@ init(LttvTracesetState *self, LttvTraceset *ts)
 static void
 fini(LttvTracesetState *self)
 {
-  guint i, j, nb_trace;
+  guint i, nb_trace;
 
   LttvTraceState *tcs;
 
@@ -201,9 +201,10 @@ fini(LttvTracesetState *self)
     tcs = (LttvTraceState *)(LTTV_TRACESET_CONTEXT(self)->traces[i]);
     lttv_attribute_find(tcs->parent.t_a, LTTV_STATE_TRACE_STATE_USE_COUNT, 
         LTTV_UINT, &v);
+
+    g_assert(*(v.v_uint) != 0);
     (*v.v_uint)--;
 
-    g_assert(*(v.v_uint) >= 0);
     if(*(v.v_uint) == 0) {
       free_name_tables(tcs);
       free_max_time(tcs);
@@ -729,7 +730,7 @@ static void pop_state(LttvTracefileState *tfs, LttvExecutionMode t)
   guint depth = process->execution_stack->len;
 
   if(process->state->t != t){
-    g_info("Different execution mode type (%d.%09d): ignore it\n",
+    g_info("Different execution mode type (%lu.%09lu): ignore it\n",
         tfs->parent.timestamp.tv_sec, tfs->parent.timestamp.tv_nsec);
     g_info("process state has %s when pop_int is %s\n",
                    g_quark_to_string(process->state->t),
@@ -743,7 +744,7 @@ static void pop_state(LttvTracefileState *tfs, LttvExecutionMode t)
   }
 
   if(depth == 1){
-    g_info("Trying to pop last state on stack (%d.%09d): ignore it\n",
+    g_info("Trying to pop last state on stack (%lu.%09lu): ignore it\n",
         tfs->parent.timestamp.tv_sec, tfs->parent.timestamp.tv_nsec);
     return;
   }
@@ -1254,6 +1255,8 @@ static gboolean block_end(void *hook_data, void *call_data)
   self->saved_position = 0;
   *(tcs->max_time_state_recomputed_in_seek) = self->parent.timestamp;
   g_free(ep);
+
+  return FALSE;
 }
 
 
@@ -1261,7 +1264,7 @@ void lttv_state_save_add_event_hooks(LttvTracesetState *self)
 {
   LttvTraceset *traceset = self->parent.ts;
 
-  guint i, j, k, nb_trace, nb_tracefile;
+  guint i, j, nb_trace, nb_tracefile;
 
   LttvTraceState *ts;
 
@@ -1304,7 +1307,7 @@ void lttv_state_save_remove_event_hooks(LttvTracesetState *self)
 {
   LttvTraceset *traceset = self->parent.ts;
 
-  guint i, j, k, nb_trace, nb_tracefile;
+  guint i, j, nb_trace, nb_tracefile;
 
   LttvTraceState *ts;
 
@@ -1347,7 +1350,7 @@ void lttv_state_traceset_seek_time_closest(LttvTracesetState *self, LttTime t)
 {
   LttvTraceset *traceset = self->parent.ts;
 
-  guint i, j, nb_trace, nb_saved_state;
+  guint i, nb_trace;
 
   int min_pos, mid_pos, max_pos;
 
@@ -1452,7 +1455,8 @@ lttv_traceset_state_get_type(void)
       NULL,   /* class_data */
       sizeof (LttvTracesetState),
       0,      /* n_preallocs */
-      (GInstanceInitFunc) traceset_state_instance_init    /* instance_init */
+      (GInstanceInitFunc) traceset_state_instance_init,    /* instance_init */
+      NULL    /* value handling */
     };
 
     type = g_type_register_static (LTTV_TRACESET_CONTEXT_TYPE, "LttvTracesetStateType", 
@@ -1502,7 +1506,8 @@ lttv_trace_state_get_type(void)
       NULL,   /* class_data */
       sizeof (LttvTraceState),
       0,      /* n_preallocs */
-      (GInstanceInitFunc) trace_state_instance_init    /* instance_init */
+      (GInstanceInitFunc) trace_state_instance_init,    /* instance_init */
+      NULL    /* value handling */
     };
 
     type = g_type_register_static (LTTV_TRACE_CONTEXT_TYPE, 
@@ -1549,7 +1554,8 @@ lttv_tracefile_state_get_type(void)
       NULL,   /* class_data */
       sizeof (LttvTracefileState),
       0,      /* n_preallocs */
-      (GInstanceInitFunc) tracefile_state_instance_init    /* instance_init */
+      (GInstanceInitFunc) tracefile_state_instance_init,    /* instance_init */
+      NULL    /* value handling */
     };
 
     type = g_type_register_static (LTTV_TRACEFILE_CONTEXT_TYPE, 
index c6b69b546a8e3e1ac75b103ba2fcfe0d4e925d0f..a88e2997ae3adf7e6241d184067ab5ce6b2455df 100644 (file)
@@ -198,7 +198,8 @@ GType lttv_traceset_state_get_type (void);
 struct _LttvTraceState {
   LttvTraceContext parent;
 
-  GHashTable *processes;  /* LttvProcessState objects indexed by pid */
+  GHashTable *processes;  /* LttvProcessState objects indexed by pid and
+                             last_cpu */
   guint nb_event, save_interval;
   /* Block/char devices, locks, memory pages... */
   GQuark *eventtype_names;
index b56eb36fda3a9107785a86fe42109cf9cd7d9b2b..c2fca6840c3757792621916a3e8cc99f190838a1 100644 (file)
@@ -49,10 +49,8 @@ static GQuark
   LTTV_STATS_BEFORE_HOOKS,
   LTTV_STATS_AFTER_HOOKS;
 
-static void remove_all_processes(GHashTable *processes);
-
 static void
-find_event_tree(LttvTracefileStats *tfcs, GQuark process, GQuark cpu,
+find_event_tree(LttvTracefileStats *tfcs, GQuark pid_time, GQuark cpu,
     GQuark mode, GQuark sub_mode, LttvAttribute **events_tree, 
     LttvAttribute **event_types_tree);
 
@@ -252,11 +250,13 @@ lttv_traceset_stats_get_type(void)
       NULL,   /* class_data */
       sizeof (LttvTracesetStats),
       0,      /* n_preallocs */
-      (GInstanceInitFunc) traceset_stats_instance_init    /* instance_init */
+      (GInstanceInitFunc) traceset_stats_instance_init,    /* instance_init */
+      NULL    /* Value handling */
     };
 
-    type = g_type_register_static (LTTV_TRACESET_STATE_TYPE, "LttvTracesetStatsType", 
-        &info, 0);
+    type = g_type_register_static (LTTV_TRACESET_STATE_TYPE,
+                                   "LttvTracesetStatsType", 
+                                   &info, 0);
   }
   return type;
 }
@@ -299,7 +299,8 @@ lttv_trace_stats_get_type(void)
       NULL,   /* class_data */
       sizeof (LttvTraceStats),
       0,      /* n_preallocs */
-      (GInstanceInitFunc) trace_stats_instance_init    /* instance_init */
+      (GInstanceInitFunc) trace_stats_instance_init,    /* instance_init */
+      NULL    /* Value handling */
     };
 
     type = g_type_register_static (LTTV_TRACE_STATE_TYPE, 
@@ -346,7 +347,8 @@ lttv_tracefile_stats_get_type(void)
       NULL,   /* class_data */
       sizeof (LttvTracefileStats),
       0,      /* n_preallocs */
-      (GInstanceInitFunc) tracefile_stats_instance_init    /* instance_init */
+      (GInstanceInitFunc) tracefile_stats_instance_init,    /* instance_init */
+      NULL    /* Value handling */
     };
 
     type = g_type_register_static (LTTV_TRACEFILE_STATE_TYPE, 
@@ -357,21 +359,25 @@ lttv_tracefile_stats_get_type(void)
 
 
 static void
-find_event_tree(LttvTracefileStats *tfcs, GQuark process, GQuark cpu,
-    GQuark mode, GQuark sub_mode, LttvAttribute **events_tree, 
-    LttvAttribute **event_types_tree)
+find_event_tree(LttvTracefileStats *tfcs,
+                GQuark pid_time,
+                GQuark cpu,
+                GQuark mode,
+                GQuark sub_mode,
+                LttvAttribute **events_tree, 
+                LttvAttribute **event_types_tree)
 {
   LttvAttribute *a;
 
   LttvTraceStats *tcs = LTTV_TRACE_STATS(tfcs->parent.parent.t_context);
   a = lttv_attribute_find_subdir(tcs->stats, LTTV_STATS_PROCESSES);
-  a = lttv_attribute_find_subdir(a, tfcs->parent.process->pid_time);
+  a = lttv_attribute_find_subdir(a, pid_time);
   a = lttv_attribute_find_subdir(a, LTTV_STATS_CPU);
-  a = lttv_attribute_find_subdir(a, tfcs->parent.cpu_name);
+  a = lttv_attribute_find_subdir(a, cpu);
   a = lttv_attribute_find_subdir(a, LTTV_STATS_MODE_TYPES);
-  a = lttv_attribute_find_subdir(a, tfcs->parent.process->state->t);
+  a = lttv_attribute_find_subdir(a, mode);
   a = lttv_attribute_find_subdir(a, LTTV_STATS_SUBMODES);
-  a = lttv_attribute_find_subdir(a, tfcs->parent.process->state->n);
+  a = lttv_attribute_find_subdir(a, sub_mode);
   *events_tree = a;
   a = lttv_attribute_find_subdir(a, LTTV_STATS_EVENT_TYPES);
   *event_types_tree = a;
@@ -382,7 +388,8 @@ static void update_event_tree(LttvTracefileStats *tfcs)
 {
   LttvExecutionState *es = tfcs->parent.process->state;
 
-  find_event_tree(tfcs, tfcs->parent.process->pid_time, tfcs->parent.cpu_name, 
+  find_event_tree(tfcs, tfcs->parent.process->pid_time,
+      tfcs->parent.cpu_name, 
       es->t, es->n, &(tfcs->current_events_tree), 
       &(tfcs->current_event_types_tree));
 }
@@ -709,7 +716,7 @@ lttv_stats_sum_traceset(LttvTracesetStats *self)
 
 
 // Hook wrapper. call_data is a traceset context.
-gint lttv_stats_hook_add_event_hooks(void *hook_data, void *call_data)
+gboolean lttv_stats_hook_add_event_hooks(void *hook_data, void *call_data)
 {
    LttvTracesetStats *tss = (LttvTracesetStats*)call_data;
 
@@ -718,7 +725,7 @@ gint lttv_stats_hook_add_event_hooks(void *hook_data, void *call_data)
    return 0;
 }
 
-lttv_stats_add_event_hooks(LttvTracesetStats *self)
+void lttv_stats_add_event_hooks(LttvTracesetStats *self)
 {
   LttvTraceset *traceset = self->parent.parent.ts;
 
@@ -844,7 +851,7 @@ lttv_stats_add_event_hooks(LttvTracesetStats *self)
 }
 
 // Hook wrapper. call_data is a traceset context.
-gint lttv_stats_hook_remove_event_hooks(void *hook_data, void *call_data)
+gboolean lttv_stats_hook_remove_event_hooks(void *hook_data, void *call_data)
 {
    LttvTracesetStats *tss = (LttvTracesetStats*)call_data;
 
@@ -853,7 +860,7 @@ gint lttv_stats_hook_remove_event_hooks(void *hook_data, void *call_data)
    return 0;
 }
 
-lttv_stats_remove_event_hooks(LttvTracesetStats *self)
+void lttv_stats_remove_event_hooks(LttvTracesetStats *self)
 {
   LttvTraceset *traceset = self->parent.parent.ts;
 
index ef6f05cdcc52a9dfa3b458b8a99b970fd94efdd7..aba1a68b2c24b5f7e5be9a6c3841fe189df661af 100644 (file)
@@ -153,12 +153,12 @@ typedef struct _LttvTracefileStatsClass LttvTracefileStatsClass;
 
 
 // Hook wrapper. call_data is a trace context.
-gint lttv_stats_hook_add_event_hooks(void *hook_data, void *call_data);
-gboolean lttv_stats_add_event_hooks(LttvTracesetStats *self);
+gboolean lttv_stats_hook_add_event_hooks(void *hook_data, void *call_data);
+void lttv_stats_add_event_hooks(LttvTracesetStats *self);
 
 // Hook wrapper. call_data is a trace context.
-gint lttv_stats_hook_remove_event_hooks(void *hook_data, void *call_data);
-gboolean lttv_stats_remove_event_hooks(LttvTracesetStats *self);
+gboolean lttv_stats_hook_remove_event_hooks(void *hook_data, void *call_data);
+void lttv_stats_remove_event_hooks(LttvTracesetStats *self);
 
 gboolean lttv_stats_sum_traceset_hook(void *hook_data, void *call_data);
 void lttv_stats_sum_traceset(LttvTracesetStats *self);
index 89d792c5b86021a701b514eb06670b1c191d3230..e0ddd00616f8ebc88931e68210f25bfad718c075 100644 (file)
@@ -16,7 +16,7 @@
  * MA 02111-1307, USA.
  */
 
-
+#include <string.h>
 #include <lttv/tracecontext.h>
 #include <ltt/event.h>
 #include <ltt/facility.h>
@@ -30,9 +30,9 @@ gint compare_tracefile(gconstpointer a, gconstpointer b)
 {
   gint comparison;
 
-  LttvTracefileContext *trace_a = (LttvTracefileContext *)a;
+  const LttvTracefileContext *trace_a = (const LttvTracefileContext *)a;
 
-  LttvTracefileContext *trace_b = (LttvTracefileContext *)b;
+  const LttvTracefileContext *trace_b = (const LttvTracefileContext *)b;
 
   if(trace_a == trace_b) return 0;
   comparison = ltt_time_compare(trace_a->timestamp, trace_b->timestamp);
@@ -41,7 +41,9 @@ gint compare_tracefile(gconstpointer a, gconstpointer b)
   else if(trace_a->index > trace_b->index) return 1;
   if(trace_a->t_context->index < trace_b->t_context->index) return -1;
   else if(trace_a->t_context->index > trace_b->t_context->index) return 1;
+  
   g_assert(FALSE);
+  return 0; /* This should never happen */
 }
 
 struct _LttvTraceContextPosition {
@@ -465,7 +467,8 @@ lttv_traceset_context_get_type(void)
       NULL,   /* class_data */
       sizeof (LttvTracesetContext),
       0,      /* n_preallocs */
-      (GInstanceInitFunc) traceset_context_instance_init /* instance_init */
+      (GInstanceInitFunc) traceset_context_instance_init, /* instance_init */
+      NULL    /* Value handling */
     };
 
     type = g_type_register_static (G_TYPE_OBJECT, "LttvTracesetContextType", 
@@ -513,7 +516,8 @@ lttv_trace_context_get_type(void)
       NULL,   /* class_data */
       sizeof (LttvTraceContext),
       0,      /* n_preallocs */
-      (GInstanceInitFunc) trace_context_instance_init    /* instance_init */
+      (GInstanceInitFunc) trace_context_instance_init,    /* instance_init */
+      NULL    /* Value handling */
     };
 
     type = g_type_register_static (G_TYPE_OBJECT, "LttvTraceContextType", 
@@ -561,7 +565,8 @@ lttv_tracefile_context_get_type(void)
       NULL,   /* class_data */
       sizeof (LttvTracefileContext),
       0,      /* n_preallocs */
-      (GInstanceInitFunc) tracefile_context_instance_init    /* instance_init */
+      (GInstanceInitFunc) tracefile_context_instance_init,    /* instance_init */
+      NULL    /* Value handling */
     };
 
     type = g_type_register_static (G_TYPE_OBJECT, "LttvTracefileContextType", 
@@ -748,8 +753,6 @@ void lttv_process_traceset_seek_time(LttvTracesetContext *self, LttTime start)
 
   LttvTraceContext *tc;
 
-  LttvTracefileContext *tfc;
-
   nb_trace = lttv_traceset_number(self->ts);
   for(i = 0 ; i < nb_trace ; i++) {
     tc = self->traces[i];
@@ -763,8 +766,6 @@ gboolean lttv_process_tracefile_seek_position(LttvTracefileContext *self,
 {
   LttvTracefileContext *tfc = self;
 
-  LttEvent *event;
-
   GTree *pqueue = self->t_context->ts_context->pqueue;
   
   ltt_tracefile_seek_position(tfc->tf, pos);
@@ -774,7 +775,7 @@ gboolean lttv_process_tracefile_seek_position(LttvTracefileContext *self,
     g_tree_insert(pqueue, tfc, tfc);
   }
 
-
+  return TRUE;
 }
 
 gboolean lttv_process_trace_seek_position(LttvTraceContext *self, 
@@ -784,8 +785,6 @@ gboolean lttv_process_trace_seek_position(LttvTraceContext *self,
 
   LttvTracefileContext *tfc;
 
-  LttEvent *event;
-
   nb_tracefile = ltt_trace_control_tracefile_number(self->t) +
       ltt_trace_per_cpu_tracefile_number(self->t);
 
@@ -810,8 +809,6 @@ gboolean lttv_process_traceset_seek_position(LttvTracesetContext *self,
 
   LttvTraceContext *tc;
 
-  LttvTracefileContext *tfc;
-
   nb_trace = lttv_traceset_number(self->ts);
   
   if(nb_trace != pos->nb_trace)
@@ -861,9 +858,7 @@ lttv_trace_find_hook(LttTrace *t, char *facility, char *event_type,
 
   LttEventType *et;
 
-  guint nb, pos, i;
-
-  char *name;
+  guint nb, pos;
 
   nb = ltt_trace_facility_find(t, facility, &pos);
   if(nb < 1) g_error("No %s facility", facility);
@@ -929,7 +924,7 @@ void lttv_traceset_context_position_save(const LttvTracesetContext *self,
 
 void lttv_traceset_context_position_destroy(LttvTracesetContextPosition *pos)
 {
-  guint nb_trace, nb_tracefile;
+  guint nb_trace;
   guint iter_trace, iter_tracefile;
   
   nb_trace = pos->nb_trace;
@@ -1005,11 +1000,9 @@ gint lttv_traceset_context_ctx_pos_compare(const LttvTracesetContext *self,
     for(iter_tracefile = 0; iter_tracefile < nb_tracefile; iter_tracefile++) {
       tfc = tc->tracefiles[iter_tracefile];
       event = tfc->e;
-      if(
-          ret =
-            ltt_event_event_position_compare(event, 
-                            pos->t_pos[iter_trace].tf_pos[iter_tracefile])
-          != 0)
+      ret = ltt_event_event_position_compare(event, 
+                             pos->t_pos[iter_trace].tf_pos[iter_tracefile]);
+      if(ret != 0)
         return ret;
     }
   }
@@ -1037,11 +1030,10 @@ gint lttv_traceset_context_pos_pos_compare(
       g_error("lttv_traceset_context_ctx_pos_compare : nb_tracefile does not match.");
 
     for(iter_tracefile = 0; iter_tracefile < nb_tracefile; iter_tracefile++) {
-      if(ret = 
-          ltt_event_position_compare(
+      ret = ltt_event_position_compare(
                 pos1->t_pos[iter_trace].tf_pos[iter_tracefile],
-                pos2->t_pos[iter_trace].tf_pos[iter_tracefile])
-          != 0)
+                pos2->t_pos[iter_trace].tf_pos[iter_tracefile]);
+      if(ret != 0) 
         return ret;
     }
   }
index 2c2739029866ac1b30814c66458adb45ecd58866..dc652e252c15bad7a4036d1a706fe9a1b8112cfb 100644 (file)
@@ -308,5 +308,8 @@ gint lttv_traceset_context_ctx_pos_compare(const LttvTracesetContext *self,
 LttTime lttv_traceset_context_position_get_time(
                                       const LttvTracesetContextPosition *pos);
 
+gboolean lttv_process_tracefile_seek_position(LttvTracefileContext *self, 
+                                              const LttEventPosition *pos);
+
 
 #endif // PROCESSTRACE_H
index fd67c68859b834ca4daeee12fb64317456579689..a190486a0ceeaae5f7915afa1a6e6cfe3307283d 100644 (file)
@@ -71,7 +71,7 @@ LttvTrace *lttv_trace_new(LttTrace *t)
 
 LttvTraceset *lttv_traceset_copy(LttvTraceset *s_orig) 
 {
-  int i;
+  guint i;
   LttvTraceset *s;
   LttvTrace * trace;
 
This page took 0.037819 seconds and 4 git commands to generate.