From c0cb4d12b6441b5964a5017e8c58349bec15e7b8 Mon Sep 17 00:00:00 2001 From: compudj Date: Fri, 10 Mar 2006 22:11:58 +0000 Subject: [PATCH] stats ok with functions git-svn-id: http://ltt.polymtl.ca/svn@1678 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/lttv/lttv/attribute.c | 97 +++++++++++++++++-- ltt/branches/poly/lttv/lttv/attribute.h | 8 +- ltt/branches/poly/lttv/lttv/iattribute.c | 34 +++++-- ltt/branches/poly/lttv/lttv/iattribute.h | 16 ++- ltt/branches/poly/lttv/lttv/state.c | 17 +++- ltt/branches/poly/lttv/lttv/stats.c | 40 +++++--- .../gui/lttvwindow/lttvwindow/lttvwindow.c | 4 +- .../lttvwindow/lttvwindow/lttvwindowtraces.c | 4 +- .../lttv/modules/gui/statistics/statistics.c | 16 ++- .../poly/lttv/modules/text/textDump.c | 9 +- 10 files changed, 201 insertions(+), 44 deletions(-) diff --git a/ltt/branches/poly/lttv/lttv/attribute.c b/ltt/branches/poly/lttv/lttv/attribute.c index b4402b25..eab857be 100644 --- a/ltt/branches/poly/lttv/lttv/attribute.c +++ b/ltt/branches/poly/lttv/lttv/attribute.c @@ -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 diff --git a/ltt/branches/poly/lttv/lttv/attribute.h b/ltt/branches/poly/lttv/lttv/attribute.h index 517b4787..498d567c 100644 --- a/ltt/branches/poly/lttv/lttv/attribute.h +++ b/ltt/branches/poly/lttv/lttv/attribute.h @@ -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); diff --git a/ltt/branches/poly/lttv/lttv/iattribute.c b/ltt/branches/poly/lttv/lttv/iattribute.c index a447192e..0271dddb 100644 --- a/ltt/branches/poly/lttv/lttv/iattribute.c +++ b/ltt/branches/poly/lttv/lttv/iattribute.c @@ -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)); diff --git a/ltt/branches/poly/lttv/lttv/iattribute.h b/ltt/branches/poly/lttv/lttv/iattribute.h index 0783077f..cbda045f 100644 --- a/ltt/branches/poly/lttv/lttv/iattribute.h +++ b/ltt/branches/poly/lttv/lttv/iattribute.h @@ -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. */ diff --git a/ltt/branches/poly/lttv/lttv/state.c b/ltt/branches/poly/lttv/lttv/state.c index b895fa9f..07ecfc46 100644 --- a/ltt/branches/poly/lttv/lttv/state.c +++ b/ltt/branches/poly/lttv/lttv/state.c @@ -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, diff --git a/ltt/branches/poly/lttv/lttv/stats.c b/ltt/branches/poly/lttv/lttv/stats.c index 2aa0ed91..a59736c1 100644 --- a/ltt/branches/poly/lttv/lttv/stats.c +++ b/ltt/branches/poly/lttv/lttv/stats.c @@ -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); diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c index a379df5d..23721242 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c @@ -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;istr, 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: -- 2.34.1