stats ok with functions
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 10 Mar 2006 22:11:58 +0000 (22:11 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 10 Mar 2006 22:11:58 +0000 (22:11 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1678 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/lttv/attribute.c
ltt/branches/poly/lttv/lttv/attribute.h
ltt/branches/poly/lttv/lttv/iattribute.c
ltt/branches/poly/lttv/lttv/iattribute.h
ltt/branches/poly/lttv/lttv/state.c
ltt/branches/poly/lttv/lttv/stats.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c
ltt/branches/poly/lttv/modules/gui/statistics/statistics.c
ltt/branches/poly/lttv/modules/text/textDump.c

index b4402b25921f5073d4a74d6027eeea85dc45242e..eab857be844f1997b4dcea3635c6d913f7f0beb0 100644 (file)
@@ -43,6 +43,7 @@ typedef struct _Attribute {
   LttvAttributeName name;
   LttvAttributeType type;
   AttributeValue value;
+       gboolean is_named;
 } Attribute;
 
 
@@ -95,7 +96,6 @@ lttv_attribute_get_number(LttvAttribute *self)
   return self->attributes->len;
 }
 
-
 gboolean 
 lttv_attribute_named(LttvAttribute *self, gboolean *homogeneous)
 {
@@ -103,16 +103,16 @@ lttv_attribute_named(LttvAttribute *self, gboolean *homogeneous)
   return TRUE;
 }
 
-
 LttvAttributeType 
 lttv_attribute_get(LttvAttribute *self, unsigned i, LttvAttributeName *name, 
-    LttvAttributeValue *v)
+    LttvAttributeValue *v, gboolean *is_named)
 {
   Attribute *a;
 
   a = &g_array_index(self->attributes, Attribute, i);
   *name = a->name;
   *v = address_of_value(a->type, &(a->value));
+       *is_named = a->is_named;
   return a->type;
 }
 
@@ -150,6 +150,30 @@ lttv_attribute_add(LttvAttribute *self, LttvAttributeName name,
   if(i != 0) g_error("duplicate entry in attribute table");
 
   a.name = name;
+       a.is_named = 1;
+  a.type = t;
+  a.value = init_value(t);
+  g_array_append_val(self->attributes, a);
+  i = self->attributes->len - 1;
+  pa = &g_array_index(self->attributes, Attribute, i);
+  g_hash_table_insert(self->names, GUINT_TO_POINTER(name), 
+      GUINT_TO_POINTER(i + 1));
+  return address_of_value(t, &(pa->value));
+}
+
+LttvAttributeValue 
+lttv_attribute_add_unnamed(LttvAttribute *self, LttvAttributeName name, 
+    LttvAttributeType t)
+{
+  unsigned i;
+
+  Attribute a, *pa;
+
+  i = (unsigned)g_hash_table_lookup(self->names, GUINT_TO_POINTER(name));
+  if(i != 0) g_error("duplicate entry in attribute table");
+
+  a.name = name;
+       a.is_named = 0;
   a.type = t;
   a.value = init_value(t);
   g_array_append_val(self->attributes, a);
@@ -226,6 +250,29 @@ lttv_attribute_find_subdir(LttvAttribute *self, LttvAttributeName name)
   return (LttvAttribute *)new;
 }
 
+/*CHECK*/LttvAttribute* 
+lttv_attribute_find_subdir_unnamed(LttvAttribute *self, LttvAttributeName name)
+{
+  unsigned i;
+
+  Attribute a;
+
+  LttvAttribute *new;
+  
+  i = (unsigned)g_hash_table_lookup(self->names, GUINT_TO_POINTER(name));
+  if(likely(i != 0)) {
+    a = g_array_index(self->attributes, Attribute, i - 1);
+    if(likely(a.type == LTTV_GOBJECT && LTTV_IS_IATTRIBUTE(a.value.dv_gobject))) {
+      return LTTV_ATTRIBUTE(a.value.dv_gobject);
+    }
+    else return NULL;    
+  }
+  new = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL);
+  *(lttv_attribute_add_unnamed(self, name, LTTV_GOBJECT).v_gobject)
+               = G_OBJECT(new);
+  return (LttvAttribute *)new;
+}
+
 gboolean 
 lttv_attribute_find(LttvAttribute *self, LttvAttributeName name, 
     LttvAttributeType t, LttvAttributeValue *v)
@@ -246,6 +293,26 @@ lttv_attribute_find(LttvAttribute *self, LttvAttributeName name,
   return TRUE;
 }
 
+gboolean 
+lttv_attribute_find_unnamed(LttvAttribute *self, LttvAttributeName name, 
+    LttvAttributeType t, LttvAttributeValue *v)
+{
+  unsigned i;
+
+  Attribute *a;
+
+  i = (unsigned)g_hash_table_lookup(self->names, GUINT_TO_POINTER(name));
+  if(likely(i != 0)) {
+    a = &g_array_index(self->attributes, Attribute, i - 1);
+    if(unlikely(a->type != t)) return FALSE;
+    *v = address_of_value(t, &(a->value));
+    return TRUE;
+  }
+
+  *v = lttv_attribute_add_unnamed(self, name, t);
+  return TRUE;
+}
+
 
 /*void lttv_attribute_recursive_free(LttvAttribute *self)
 {
@@ -278,12 +345,20 @@ void lttv_attribute_recursive_add(LttvAttribute *dest, LttvAttribute *src)
   for(i = 0 ; i < nb ; i++) {
     a = &g_array_index(src->attributes, Attribute, i);
     if(a->type == LTTV_GOBJECT && LTTV_IS_ATTRIBUTE(a->value.dv_gobject)) {
-      lttv_attribute_recursive_add(
-      /*CHECK*/(LttvAttribute *)lttv_attribute_find_subdir(dest, a->name),
-          (LttvAttribute *)(a->value.dv_gobject));
+                       if(a->is_named)
+             lttv_attribute_recursive_add(
+           /*CHECK*/(LttvAttribute *)lttv_attribute_find_subdir(dest, a->name),
+             (LttvAttribute *)(a->value.dv_gobject));
+                       else
+             lttv_attribute_recursive_add(
+           /*CHECK*/(LttvAttribute *)lttv_attribute_find_subdir_unnamed(
+                                               dest, a->name), (LttvAttribute *)(a->value.dv_gobject));
     }
     else {
-      g_assert(lttv_attribute_find(dest, a->name, a->type, &value));
+                       if(a->is_named)
+             g_assert(lttv_attribute_find(dest, a->name, a->type, &value));
+                       else
+             g_assert(lttv_attribute_find_unnamed(dest, a->name, a->type, &value));
       switch(a->type) {
              case LTTV_INT:
           *value.v_int += a->value.dv_int;
@@ -500,7 +575,8 @@ attribute_interface_init (gpointer g_iface, gpointer iface_data)
       lttv_attribute_named;
 
   klass->get = (LttvAttributeType (*) (LttvIAttribute *self, unsigned i, 
-      LttvAttributeName *name, LttvAttributeValue *v)) lttv_attribute_get;
+      LttvAttributeName *name, LttvAttributeValue *v, gboolean *is_named)) 
+                       lttv_attribute_get;
 
   klass->get_by_name = (LttvAttributeType (*) (LttvIAttribute *self,
       LttvAttributeName name, LttvAttributeValue *v)) 
@@ -509,6 +585,9 @@ attribute_interface_init (gpointer g_iface, gpointer iface_data)
   klass->add = (LttvAttributeValue (*) (LttvIAttribute *self, 
       LttvAttributeName name, LttvAttributeType t)) lttv_attribute_add;
 
+  klass->add_unnamed = (LttvAttributeValue (*) (LttvIAttribute *self, 
+      LttvAttributeName name, LttvAttributeType t)) lttv_attribute_add_unnamed;
+
   klass->remove = (void (*) (LttvIAttribute *self, unsigned i)) 
       lttv_attribute_remove;
 
@@ -518,6 +597,8 @@ attribute_interface_init (gpointer g_iface, gpointer iface_data)
   klass->find_subdir = (LttvIAttribute* (*) (LttvIAttribute *self, 
       LttvAttributeName name)) lttv_attribute_find_subdir;
 
+  klass->find_subdir = (LttvIAttribute* (*) (LttvIAttribute *self, 
+      LttvAttributeName name)) lttv_attribute_find_subdir_unnamed;
 }
 
 static void
index 517b4787a9d00eda435f514449fd8f1602149950..498d567c8db6e2d1990820cb08e055d25855692a 100644 (file)
@@ -70,7 +70,7 @@ gboolean lttv_attribute_named(LttvAttribute *self, gboolean *homogeneous);
 /* Get the i th attribute along with its type and a pointer to its value. */
 
 LttvAttributeType lttv_attribute_get(LttvAttribute *self, unsigned i, 
-    LttvAttributeName *name, LttvAttributeValue *v);
+    LttvAttributeName *name, LttvAttributeValue *v, gboolean *is_named);
  
 
 /* Get the named attribute in the table along with its type and a pointer to
@@ -86,6 +86,8 @@ LttvAttributeType lttv_attribute_get_by_name(LttvAttribute *self,
 LttvAttributeValue lttv_attribute_add(LttvAttribute *self, 
     LttvAttributeName name, LttvAttributeType t);
 
+LttvAttributeValue lttv_attribute_add_unnamed(LttvAttribute *self, 
+    LttvAttributeName name, LttvAttributeType t);
 
 /* Remove an attribute */
 
@@ -103,6 +105,10 @@ void lttv_attribute_remove_by_name(LttvAttribute *self,
 LttvAttribute* lttv_attribute_find_subdir(LttvAttribute *self, 
       LttvAttributeName name);
 
+LttvAttribute* lttv_attribute_find_subdir_unnamed(LttvAttribute *self, 
+      LttvAttributeName name);
+
+
 gboolean lttv_attribute_find(LttvAttribute *self, LttvAttributeName name, 
     LttvAttributeType t, LttvAttributeValue *v);
 
index a447192e9c20b4fa2d8d1dcb6ad2dac728034c1c..0271dddb65d3836e10932c31539e1bc5a6a398b6 100644 (file)
@@ -69,9 +69,9 @@ gboolean lttv_iattribute_named(LttvIAttribute *self, gboolean *homogeneous)
 
 
 LttvAttributeType lttv_iattribute_get(LttvIAttribute *self, unsigned i, 
-    LttvAttributeName *name, LttvAttributeValue *v)
+    LttvAttributeName *name, LttvAttributeValue *v, gboolean *is_named)
 {
-  return LTTV_IATTRIBUTE_GET_CLASS (self)->get (self, i, name, v);
+  return LTTV_IATTRIBUTE_GET_CLASS (self)->get (self, i, name, v, is_named);
 }
  
 
@@ -88,6 +88,11 @@ LttvAttributeValue lttv_iattribute_add(LttvIAttribute *self,
   return LTTV_IATTRIBUTE_GET_CLASS (self)->add (self, name, t);
 }
 
+LttvAttributeValue lttv_iattribute_add_unnamed(LttvIAttribute *self, 
+    LttvAttributeName name, LttvAttributeType t)
+{
+  return LTTV_IATTRIBUTE_GET_CLASS (self)->add_unnamed (self, name, t);
+}
 
 void lttv_iattribute_remove(LttvIAttribute *self, unsigned i)
 {
@@ -107,6 +112,13 @@ LttvIAttribute* lttv_iattribute_find_subdir(LttvIAttribute *self,
   return LTTV_IATTRIBUTE_GET_CLASS (self)->find_subdir (self, name);
 }
 
+LttvIAttribute* lttv_iattribute_find_subdir_unnamed(LttvIAttribute *self, 
+      LttvAttributeName name)
+{
+  return LTTV_IATTRIBUTE_GET_CLASS (self)->find_subdir_unnamed (self, name);
+}
+
+
 
 /* Find the named attribute in the table, which must be of the specified type.
    If it does not exist, it is created with a default value of 0 (NULL for
@@ -190,6 +202,8 @@ LttvIAttribute *lttv_iattribute_shallow_copy(LttvIAttribute *self)
 
   LttvAttributeName name;
 
+       gboolean is_named;
+
   int i;
 
   int nb_attributes = lttv_iattribute_get_number(self);
@@ -197,8 +211,11 @@ LttvIAttribute *lttv_iattribute_shallow_copy(LttvIAttribute *self)
   copy = LTTV_IATTRIBUTE_GET_CLASS(self)->new_attribute(NULL);
 
   for(i = 0 ; i < nb_attributes ; i++) {
-    t = lttv_iattribute_get(self, i, &name, &v);
-    v_copy = lttv_iattribute_add(copy, name, t);
+    t = lttv_iattribute_get(self, i, &name, &v, &is_named);
+               if(is_named)
+           v_copy = lttv_iattribute_add(copy, name, t);
+               else
+           v_copy = lttv_iattribute_add_unnamed(copy, name, t);
     lttv_iattribute_copy_value(t, v_copy, v);
   }
   return copy;
@@ -214,6 +231,8 @@ LttvIAttribute *lttv_iattribute_deep_copy(LttvIAttribute *self)
 
   LttvAttributeName name;
 
+       gboolean is_named;
+
   int i;
 
   int nb_attributes = lttv_iattribute_get_number(self);
@@ -221,8 +240,11 @@ LttvIAttribute *lttv_iattribute_deep_copy(LttvIAttribute *self)
   copy = LTTV_IATTRIBUTE_GET_CLASS(self)->new_attribute(NULL);
 
   for(i = 0 ; i < nb_attributes ; i++) {
-    t = lttv_iattribute_get(self, i, &name, &v);
-    v_copy = lttv_iattribute_add(copy, name, t);
+    t = lttv_iattribute_get(self, i, &name, &v, &is_named);
+               if(is_named)
+       v_copy = lttv_iattribute_add(copy, name, t);
+               else
+       v_copy = lttv_iattribute_add_unnamed(copy, name, t);
     if(t == LTTV_GOBJECT && LTTV_IS_IATTRIBUTE(*(v.v_gobject))) {
       child = LTTV_IATTRIBUTE(*(v.v_gobject));
       *(v_copy.v_gobject) = G_OBJECT(lttv_iattribute_deep_copy(child));
index 0783077f646473fd3d33f584575ad6b3a8348a46..cbda045f4bba5db151a75c11d99d3de82f01d5c2 100644 (file)
@@ -82,7 +82,7 @@ struct _LttvIAttributeClass {
   gboolean (*named) (LttvIAttribute *self, gboolean *homogeneous);
 
   LttvAttributeType (*get) (LttvIAttribute *self, unsigned i, 
-      LttvAttributeName *name, LttvAttributeValue *v);
+      LttvAttributeName *name, LttvAttributeValue *v, gboolean *is_named);
 
   LttvAttributeType (*get_by_name) (LttvIAttribute *self,
       LttvAttributeName name, LttvAttributeValue *v);
@@ -90,6 +90,10 @@ struct _LttvIAttributeClass {
   LttvAttributeValue (*add) (LttvIAttribute *self, LttvAttributeName name, 
       LttvAttributeType t);
 
+  LttvAttributeValue (*add_unnamed) (LttvIAttribute *self,
+                       LttvAttributeName name,
+      LttvAttributeType t);
+
   void (*remove) (LttvIAttribute *self, unsigned i);
 
   void (*remove_by_name) (LttvIAttribute *self,
@@ -97,6 +101,10 @@ struct _LttvIAttributeClass {
 
   LttvIAttribute* (*find_subdir) (LttvIAttribute *self, 
       LttvAttributeName name);
+
+  LttvIAttribute* (*find_subdir_unnamed) (LttvIAttribute *self, 
+      LttvAttributeName name);
+
 };
 
 
@@ -117,7 +125,7 @@ gboolean lttv_iattribute_named(LttvIAttribute *self, gboolean *homogeneous);
 /* Get the i th attribute along with its type and a pointer to its value. */
 
 LttvAttributeType lttv_iattribute_get(LttvIAttribute *self, unsigned i, 
-    LttvAttributeName *name, LttvAttributeValue *v);
+    LttvAttributeName *name, LttvAttributeValue *v, gboolean *is_named);
  
 
 /* Get the named attribute in the table along with its type and a pointer to
@@ -134,6 +142,8 @@ LttvAttributeType lttv_iattribute_get_by_name(LttvIAttribute *self,
 LttvAttributeValue lttv_iattribute_add(LttvIAttribute *self, 
     LttvAttributeName name, LttvAttributeType t);
 
+LttvAttributeValue lttv_iattribute_add_unnamed(LttvIAttribute *self, 
+    LttvAttributeName name, LttvAttributeType t);
 /* Remove an attribute */
 
 void lttv_iattribute_remove(LttvIAttribute *self, unsigned i);
@@ -150,6 +160,8 @@ void lttv_iattribute_remove_by_name(LttvIAttribute *self,
 LttvIAttribute* lttv_iattribute_find_subdir(LttvIAttribute *self, 
       LttvAttributeName name);
 
+LttvIAttribute* lttv_iattribute_find_subdir_unnamed(LttvIAttribute *self, 
+      LttvAttributeName name);
 
 /* The remaining utility functions are not part of the LttvIAttribute
    interface but operate on objects implementing it. */
index b895fa9f5b82d7f5d6b219a178176774f8635ae8..07ecfc46603e30cd67d76d11d5f141fb182e945e 100644 (file)
@@ -624,6 +624,8 @@ static void state_restore(LttvTraceState *self, LttvAttribute *container)
 
   LttvAttributeName name;
 
+       gboolean is_named;
+
   LttEventPosition *ep;
 
   LttvTracesetContext *tsc = self->parent.ts_context;
@@ -659,7 +661,7 @@ static void state_restore(LttvTraceState *self, LttvAttribute *container)
     tfcs = 
           LTTV_TRACEFILE_STATE(g_array_index(self->parent.tracefiles,
                                           LttvTracefileContext*, i));
-    type = lttv_attribute_get(tracefiles_tree, i, &name, &value);
+    type = lttv_attribute_get(tracefiles_tree, i, &name, &value, &is_named);
     g_assert(type == LTTV_GOBJECT);
     tracefile_tree = *((LttvAttribute **)(value.v_gobject));
 #if 0
@@ -708,6 +710,8 @@ static void state_saved_free(LttvTraceState *self, LttvAttribute *container)
 
   LttvAttributeName name;
 
+       gboolean is_named;
+
   LttEventPosition *ep;
 
   tracefiles_tree = lttv_attribute_find_subdir(container, 
@@ -736,7 +740,7 @@ static void state_saved_free(LttvTraceState *self, LttvAttribute *container)
     tfcs = 
           LTTV_TRACEFILE_STATE(g_array_index(self->parent.tracefiles,
                                           LttvTracefileContext*, i));
-    type = lttv_attribute_get(tracefiles_tree, i, &name, &value);
+    type = lttv_attribute_get(tracefiles_tree, i, &name, &value, &is_named);
     g_assert(type == LTTV_GOBJECT);
     tracefile_tree = *((LttvAttribute **)(value.v_gobject));
 
@@ -759,6 +763,8 @@ static void free_saved_state(LttvTraceState *self)
 
   LttvAttributeName name;
 
+       gboolean is_named;
+
   LttvAttribute *saved_states;
 
   saved_states = lttv_attribute_find_subdir(self->parent.t_a,
@@ -766,7 +772,7 @@ static void free_saved_state(LttvTraceState *self)
 
   nb = lttv_attribute_get_number(saved_states);
   for(i = 0 ; i < nb ; i++) {
-    type = lttv_attribute_get(saved_states, i, &name, &value);
+    type = lttv_attribute_get(saved_states, i, &name, &value, &is_named);
     g_assert(type == LTTV_GOBJECT);
     state_saved_free(self, *((LttvAttribute **)value.v_gobject));
   }
@@ -2372,6 +2378,8 @@ void lttv_state_traceset_seek_time_closest(LttvTracesetState *self, LttTime t)
 
   LttvAttributeName name;
 
+       gboolean is_named;
+
   LttvAttribute *saved_states_tree, *saved_state_tree, *closest_tree;
 
   //g_tree_destroy(self->parent.pqueue);
@@ -2392,7 +2400,8 @@ void lttv_state_traceset_seek_time_closest(LttvTracesetState *self, LttTime t)
         max_pos = lttv_attribute_get_number(saved_states_tree) - 1;
         mid_pos = max_pos / 2;
         while(min_pos < max_pos) {
-          type = lttv_attribute_get(saved_states_tree, mid_pos, &name, &value);
+          type = lttv_attribute_get(saved_states_tree, mid_pos, &name, &value,
+                                                       &is_named);
           g_assert(type == LTTV_GOBJECT);
           saved_state_tree = *((LttvAttribute **)(value.v_gobject));
           type = lttv_attribute_get_by_name(saved_state_tree, LTTV_STATE_TIME, 
index 2aa0ed917d5cb0b9dd3ef3a1d3a3f72b10a4014d..a59736c12f3ee62ff693d9e4d0197e7af22eb6dd 100644 (file)
@@ -54,7 +54,7 @@ GQuark
   LTTV_STATS_AFTER_HOOKS;
 
 static void
-find_event_tree(LttvTracefileStats *tfcs, GQuark pid_time, GQuark cpu,
+find_event_tree(LttvTracefileStats *tfcs, GQuark pid_time, guint cpu,
                guint64 function,
     GQuark mode, GQuark sub_mode, LttvAttribute **events_tree, 
     LttvAttribute **event_types_tree);
@@ -120,8 +120,9 @@ static void lttv_stats_init(LttvTracesetStats *self)
       tfcs = LTTV_TRACEFILE_STATS(*tfs);
       tfcs->stats = lttv_attribute_find_subdir(tracefiles_stats, 
           ltt_tracefile_long_name(tfcs->parent.parent.tf));
+               guint cpu = tfcs->parent.cpu;
       find_event_tree(tfcs, LTTV_STATS_PROCESS_UNKNOWN,
-          ltt_tracefile_long_name(tfcs->parent.parent.tf),
+                                       cpu,
                                        0x0ULL,
           LTTV_STATE_MODE_UNKNOWN, 
           LTTV_STATE_SUBMODE_UNKNOWN, &tfcs->current_events_tree,
@@ -395,14 +396,14 @@ lttv_tracefile_stats_get_type(void)
 static void
 find_event_tree(LttvTracefileStats *tfcs,
                 GQuark pid_time,
-                GQuark cpu,
+                guint cpu,
                                                                guint64 function,
                 GQuark mode,
                 GQuark sub_mode,
                 LttvAttribute **events_tree, 
                 LttvAttribute **event_types_tree)
 {
-  LttvAttribute *a;
+  LttvAttribute *a, *prev_a;
        gchar fstring[MAX_64_HEX_STRING_LEN];
 
        g_assert(snprintf(fstring, MAX_64_HEX_STRING_LEN-1,
@@ -413,7 +414,7 @@ find_event_tree(LttvTracefileStats *tfcs,
   a = lttv_attribute_find_subdir(tcs->stats, LTTV_STATS_PROCESSES);
   a = lttv_attribute_find_subdir(a, pid_time);
   a = lttv_attribute_find_subdir(a, LTTV_STATS_CPU);
-  a = lttv_attribute_find_subdir(a, cpu);
+  a = lttv_attribute_find_subdir_unnamed(a, cpu);
   a = lttv_attribute_find_subdir(a, LTTV_STATS_FUNCTIONS);
   a = lttv_attribute_find_subdir(a, g_quark_from_string(fstring));
   a = lttv_attribute_find_subdir(a, LTTV_STATS_MODE_TYPES);
@@ -434,7 +435,7 @@ static void update_event_tree(LttvTracefileStats *tfcs)
   LttvExecutionState *es = process->state;
 
   find_event_tree(tfcs, process->pid_time,
-      ltt_tracefile_long_name(tfcs->parent.parent.tf),
+      cpu,
                        process->current_function,
       es->t, es->n, &(tfcs->current_events_tree), 
       &(tfcs->current_event_types_tree));
@@ -644,8 +645,10 @@ gboolean before_schedchange(void *hook_data, void *call_data)
   process = lttv_state_find_process_or_create(ts, 
       ANY_CPU, pid_in, &tfcs->parent.parent.timestamp);
 
+  guint cpu = tfcs->parent.cpu;
+
   find_event_tree(tfcs, process->pid_time,
-      ltt_tracefile_long_name(tfcs->parent.parent.tf), 
+      cpu,
                        process->current_function,
       process->state->t, process->state->n, &(tfcs->current_events_tree), 
       &(tfcs->current_event_types_tree));
@@ -708,6 +711,8 @@ lttv_stats_sum_trace(LttvTraceStats *self)
 
   LttvAttributeName name;
 
+       gboolean is_named;
+
   unsigned sum;
 
   int i, j, k, l, m, nb_process, nb_cpu, nb_mode_type, nb_submode,
@@ -734,30 +739,32 @@ lttv_stats_sum_trace(LttvTraceStats *self)
   nb_process = lttv_attribute_get_number(processes_tree);
 
   for(i = 0 ; i < nb_process ; i++) {
-    type = lttv_attribute_get(processes_tree, i, &name, &value);
+    type = lttv_attribute_get(processes_tree, i, &name, &value, &is_named);
     process_tree = LTTV_ATTRIBUTE(*(value.v_gobject));
 
     cpus_tree = lttv_attribute_find_subdir(process_tree, LTTV_STATS_CPU);
     nb_cpu = lttv_attribute_get_number(cpus_tree);
 
     for(j = 0 ; j < nb_cpu ; j++) {
-      type = lttv_attribute_get(cpus_tree, j, &name, &value);
+      type = lttv_attribute_get(cpus_tree, j, &name, &value, &is_named);
       cpu_tree = LTTV_ATTRIBUTE(*(value.v_gobject));
 
       trace_cpu_tree = lttv_attribute_find_subdir(main_tree, LTTV_STATS_CPU);
-      trace_cpu_tree = lttv_attribute_find_subdir(trace_cpu_tree, name);
+      trace_cpu_tree = lttv_attribute_find_subdir_unnamed(trace_cpu_tree, name);
                        cpu_functions_tree = lttv_attribute_find_subdir(cpu_tree,
                                                                                                                                                                                                                        LTTV_STATS_FUNCTIONS);
        nb_functions = lttv_attribute_get_number(cpu_functions_tree);
                        
                        for(nf=0; nf < nb_functions; nf++) {
-                               type = lttv_attribute_get(cpu_functions_tree, nf, &name, &value);
+                               type = lttv_attribute_get(cpu_functions_tree, nf, &name, &value,
+                                               &is_named);
                                function_tree = LTTV_ATTRIBUTE(*(value.v_gobject));
                                function_mode_types_tree = lttv_attribute_find_subdir(function_tree,
                                                LTTV_STATS_MODE_TYPES);
        nb_mode_type = lttv_attribute_get_number(function_mode_types_tree);
                                for(k = 0 ; k < nb_mode_type ; k++) {
-                                       type = lttv_attribute_get(function_mode_types_tree, k, &name, &value);
+                                       type = lttv_attribute_get(function_mode_types_tree, k, &name, &value,
+                                                       &is_named);
                                        mode_tree = LTTV_ATTRIBUTE(*(value.v_gobject));
 
                                        submodes_tree = lttv_attribute_find_subdir(mode_tree, 
@@ -770,7 +777,8 @@ lttv_stats_sum_trace(LttvTraceStats *self)
                                        nb_submode = lttv_attribute_get_number(submodes_tree);
 
                                        for(l = 0 ; l < nb_submode ; l++) {
-                                               type = lttv_attribute_get(submodes_tree, l, &name, &value);
+                                               type = lttv_attribute_get(submodes_tree, l, &name, &value,
+                                                               &is_named);
                                                submode_tree = LTTV_ATTRIBUTE(*(value.v_gobject));
 
                                                event_types_tree = lttv_attribute_find_subdir(submode_tree, 
@@ -779,14 +787,16 @@ lttv_stats_sum_trace(LttvTraceStats *self)
 
                                                sum = 0;
                                                for(m = 0 ; m < nb_event_type ; m++) {
-                                                       type = lttv_attribute_get(event_types_tree, m, &name, &value);
+                                                       type = lttv_attribute_get(event_types_tree, m, &name, &value,
+                                                                       &is_named);
                                                        sum += *(value.v_uint);
                                                }
                                                lttv_attribute_find(submode_tree, LTTV_STATS_EVENTS_COUNT, 
                                                                LTTV_UINT, &value);
                                                *(value.v_uint) = sum;
 
-                                               type = lttv_attribute_get(submodes_tree, l, &name, &value);
+                                               type = lttv_attribute_get(submodes_tree, l, &name, &value,
+                                                               &is_named);
                                                submode_tree = LTTV_ATTRIBUTE(*(value.v_gobject));
                                                lttv_attribute_recursive_add(mode_events_tree, event_types_tree);
                                                lttv_attribute_recursive_add(mode_types_tree, submode_tree);
index a379df5d8152a03ffdafcb7baa53967a92a404b6..2372124273ceb179f4272dce7dfad5fdcd096712 100644 (file)
@@ -344,6 +344,7 @@ void lttvwindow_unregister_constructor
   LttvToolbars * toolbar;
   LttvMenus * menu;
   LttvAttributeValue value;
+       gboolean is_named;
 
   g_assert(lttv_iattribute_find_by_path(attributes_global,
      "viewers/toolbar", LTTV_POINTER, &value));
@@ -381,7 +382,8 @@ void lttvwindow_unregister_constructor
     LttvAttributeType type;
     
     for(i=0;i<num;i++) {
-      type = lttv_iattribute_get(LTTV_IATTRIBUTE(attribute), i, &name, &value);
+      type = lttv_iattribute_get(LTTV_IATTRIBUTE(attribute), i, &name, &value,
+                                       &is_named);
       g_assert(type == LTTV_POINTER);
       if(*(value.v_pointer) == view_constructor) {
         lttv_iattribute_remove(LTTV_IATTRIBUTE(attribute), i);
index 76992022167afc01054e5d9ba87e151332708922..badb3a34836a405580383eaea16205615732d402 100644 (file)
@@ -104,12 +104,14 @@ LttvTrace *lttvwindowtraces_get_trace(guint num)
   LttvAttributeType type;
   LttvAttributeName name;
   LttvAttributeValue value;
+       gboolean is_named;
 
   g_assert(attribute = 
       LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(g_attribute),
                                 LTTV_TRACES)));
   
-  type = lttv_iattribute_get(LTTV_IATTRIBUTE(attribute), num, &name, &value);
+  type = lttv_iattribute_get(LTTV_IATTRIBUTE(attribute), num, &name, &value,
+                       &is_named);
 
   if(type == LTTV_POINTER) {
     return (LttvTrace *)*(value.v_pointer);
index b9b341e9791dcaf96c7665beacb071136ed1ca71..d39b11d1f6900c5a5e74e8209870134b47431c5c 100644 (file)
@@ -472,6 +472,7 @@ void show_tree(StatisticViewerData * statistic_viewer_data,
   LttvAttributeName name;
   LttvAttributeValue value;
   LttvAttributeType type;
+       gboolean is_named;
   gchar * str, dir_str[PATH_LENGTH];
   GtkTreePath * path;
   GtkTreeIter   iter;
@@ -479,12 +480,15 @@ void show_tree(StatisticViewerData * statistic_viewer_data,
 
   nb = lttv_attribute_get_number(stats);
   for(i = 0 ; i < nb ; i++) {
-    type = lttv_attribute_get(stats, i, &name, &value);
+    type = lttv_attribute_get(stats, i, &name, &value, &is_named);
     switch(type) {
      case LTTV_GOBJECT:
         if(LTTV_IS_ATTRIBUTE(*(value.v_gobject))) {
-    sprintf(dir_str, "%s", g_quark_to_string(name));
           subtree = (LttvAttribute *)*(value.v_gobject);
+               if(is_named)
+           sprintf(dir_str, "%s", g_quark_to_string(name));
+               else
+                       sprintf(dir_str, "%lu", name);
     gtk_tree_store_append (store, &iter, parent);  
     gtk_tree_store_set (store, &iter,NAME_COLUMN,dir_str,-1);  
     path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
@@ -507,14 +511,18 @@ void show_statistic(StatisticViewerData * statistic_viewer_data,
   LttvAttributeName name;
   LttvAttributeValue value;
   LttvAttributeType type;
+       gboolean is_named;
   gchar type_name[PATH_LENGTH], type_value[PATH_LENGTH];
   GtkTextIter   text_iter;
   
   flag = 0;
   nb = lttv_attribute_get_number(stats);
   for(i = 0 ; i < nb ; i++) {
-    type = lttv_attribute_get(stats, i, &name, &value);
-    sprintf(type_name,"%s", g_quark_to_string(name));
+    type = lttv_attribute_get(stats, i, &name, &value, &is_named);
+               if(is_named)
+           sprintf(type_name,"%s", g_quark_to_string(name));
+               else
+           sprintf(type_name,"%lu", name);
     type_value[0] = '\0';
     switch(type) {
       case LTTV_INT:
index a823d948b3dfaf8ab3350a3342e308b90154241c..e522595fabd8d87f0ead8e06b03550ded6d8cd19 100644 (file)
@@ -70,10 +70,15 @@ print_tree(FILE *fp, GString *indent, LttvAttribute *tree)
 
   LttvAttributeType type;
 
+       gboolean is_named;
+
   nb = lttv_attribute_get_number(tree);
   for(i = 0 ; i < nb ; i++) {
-    type = lttv_attribute_get(tree, i, &name, &value);
-    fprintf(fp, "%s%s: ", indent->str, g_quark_to_string(name));
+    type = lttv_attribute_get(tree, i, &name, &value, &is_named);
+               if(is_named)
+           fprintf(fp, "%s%s: ", indent->str, g_quark_to_string(name));
+               else
+           fprintf(fp, "%s%lu: ", indent->str, name);
 
     switch(type) {
       case LTTV_INT:
This page took 0.033887 seconds and 4 git commands to generate.