summaryrefslogtreecommitdiff
path: root/tools/perf
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-report.c4
-rw-r--r--tools/perf/util/hist.c5
-rw-r--r--tools/perf/util/sort.h2
3 files changed, 6 insertions, 5 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 381918515a5c..1fb13e5fd1f9 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -110,8 +110,8 @@ static int perf_session__add_hist_entry(struct perf_session *self,
if (symbol_conf.use_callchain) {
if (!hit)
- callchain_init(&he->callchain);
- err = append_chain(&he->callchain, data->callchain, syms);
+ callchain_init(he->callchain);
+ err = append_chain(he->callchain, data->callchain, syms);
free(syms);
if (err)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index f0794913d575..18cf8b321608 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -50,7 +50,8 @@ struct hist_entry *__perf_session__add_hist_entry(struct rb_root *hists,
p = &(*p)->rb_right;
}
- he = malloc(sizeof(*he));
+ he = malloc(sizeof(*he) + (symbol_conf.use_callchain ?
+ sizeof(struct callchain_node) : 0));
if (!he)
return NULL;
*he = entry;
@@ -168,7 +169,7 @@ static void perf_session__insert_output_hist_entry(struct rb_root *root,
struct hist_entry *iter;
if (symbol_conf.use_callchain)
- callchain_param.sort(&he->sorted_chain, &he->callchain,
+ callchain_param.sort(&he->sorted_chain, he->callchain,
min_callchain_hits, &callchain_param);
while (*p != NULL) {
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 439ec5fa0f5f..5bf2b744e7b2 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -49,12 +49,12 @@ struct hist_entry {
u64 ip;
char level;
struct symbol *parent;
- struct callchain_node callchain;
union {
unsigned long position;
struct hist_entry *pair;
struct rb_root sorted_chain;
};
+ struct callchain_node callchain[0];
};
enum sort_type {