+static void
+print_tree(FILE *fp, GString *indent, LttvAttribute *tree)
+{
+ int i, nb, saved_length;
+
+ LttvAttribute *subtree;
+
+ LttvAttributeName name;
+
+ LttvAttributeValue value;
+
+ LttvAttributeType type;
+
+ 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));
+
+ switch(type) {
+ case LTTV_INT:
+ fprintf(fp, "%d\n", *value.v_int);
+ break;
+ case LTTV_UINT:
+ fprintf(fp, "%u\n", *value.v_uint);
+ break;
+ case LTTV_LONG:
+ fprintf(fp, "%ld\n", *value.v_long);
+ break;
+ case LTTV_ULONG:
+ fprintf(fp, "%lu\n", *value.v_ulong);
+ break;
+ case LTTV_FLOAT:
+ fprintf(fp, "%f\n", (double)*value.v_float);
+ break;
+ case LTTV_DOUBLE:
+ fprintf(fp, "%f\n", *value.v_double);
+ break;
+ case LTTV_TIME:
+ fprintf(fp, "%10u.%09u\n", value.v_time->tv_sec,
+ value.v_time->tv_nsec);
+ break;
+ case LTTV_POINTER:
+ fprintf(fp, "POINTER\n");
+ break;
+ case LTTV_STRING:
+ fprintf(fp, "%s\n", *value.v_string);
+ break;
+ case LTTV_GOBJECT:
+ if(LTTV_IS_ATTRIBUTE(*(value.v_gobject))) {
+ fprintf(fp, "\n");
+ subtree = (LttvAttribute *)*(value.v_gobject);
+ saved_length = indent->len;
+ g_string_append(indent, " ");
+ print_tree(fp, indent, subtree);
+ g_string_truncate(indent, saved_length);
+ }
+ else fprintf(fp, "GOBJECT\n");
+ break;
+ case LTTV_NONE:
+ break;
+ }
+ }
+}
+
+
+static void
+print_stats(FILE *fp, LttvTracesetStats *tscs)
+{
+ int i, nb, saved_length;
+
+ LttvTraceset *ts;
+
+ LttvTraceStats *tcs;
+
+ GString *indent;
+
+ LttSystemDescription *desc;
+
+ if(tscs->stats == NULL) return;
+ indent = g_string_new("");
+ fprintf(fp, "Traceset statistics:\n\n");
+ print_tree(fp, indent, tscs->stats);
+
+ ts = tscs->parent.parent.ts;
+ nb = lttv_traceset_number(ts);
+
+ for(i = 0 ; i < nb ; i++) {
+ tcs = (LttvTraceStats *)(LTTV_TRACESET_CONTEXT(tscs)->traces[i]);
+ desc = ltt_trace_system_description(tcs->parent.parent.t);
+ fprintf(fp, "Trace on system %s at time %d secs:\n", desc->node_name,
+ desc->trace_start.tv_sec);
+ saved_length = indent->len;
+ g_string_append(indent, " ");
+ print_tree(fp, indent, tcs->stats);
+ g_string_truncate(indent, saved_length);
+ }
+ g_string_free(indent, TRUE);
+}
+
+