}
static size_t
-callchain__fprintf_graph(FILE *fp, struct callchain_node *self,
- u64 total_samples, int depth, int depth_mask)
+__callchain__fprintf_graph(FILE *fp, struct callchain_node *self,
+ u64 total_samples, int depth, int depth_mask)
{
struct rb_node *node, *next;
struct callchain_node *child;
new_total,
cumul);
}
- ret += callchain__fprintf_graph(fp, child, new_total,
- depth + 1,
- new_depth_mask | (1 << depth));
+ ret += __callchain__fprintf_graph(fp, child, new_total,
+ depth + 1,
+ new_depth_mask | (1 << depth));
node = next;
}
}
static size_t
+callchain__fprintf_graph(FILE *fp, struct callchain_node *self,
+ u64 total_samples)
+{
+ struct callchain_list *chain;
+ int i = 0;
+ int ret = 0;
+
+ list_for_each_entry(chain, &self->val, list) {
+ if (chain->ip >= PERF_CONTEXT_MAX)
+ continue;
+
+ if (!i++ && sort_by_sym_first)
+ continue;
+
+ if (chain->sym)
+ ret += fprintf(fp, " %s\n", chain->sym->name);
+ else
+ ret += fprintf(fp, " %p\n",
+ (void *)(long)chain->ip);
+ }
+
+ ret += __callchain__fprintf_graph(fp, self, total_samples, 1, 1);
+
+ return ret;
+}
+
+static size_t
callchain__fprintf_flat(FILE *fp, struct callchain_node *self,
u64 total_samples)
{
break;
case CHAIN_GRAPH_ABS: /* Falldown */
case CHAIN_GRAPH_REL:
- ret += callchain__fprintf_graph(fp, chain,
- total_samples, 1, 1);
+ ret += callchain__fprintf_graph(fp, chain, total_samples);
case CHAIN_NONE:
default:
break;
char *parent_pattern = default_parent_pattern;
char default_sort_order[] = "comm,dso,symbol";
char *sort_order = default_sort_order;
-int sort__need_collapse = 0;
-int sort__has_parent = 0;
+int sort__need_collapse = 0;
+int sort__has_parent = 0;
+int sort_by_sym_first;
unsigned int dsos__col_width;
unsigned int comms__col_width;
sort__has_parent = 1;
}
+ if (list_empty(&hist_entry__sort_list) &&
+ !strcmp(sd->name, "symbol"))
+ sort_by_sym_first = true;
+
list_add_tail(&sd->entry->list, &hist_entry__sort_list);
sd->taken = 1;
return -ESRCH;
}
-