aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-04-02 09:50:42 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-04-02 16:28:28 -0300
commitb9fb93047756c5e4129dfda7591612de61b0e877 (patch)
tree76e66aed31494cdf9f287011bbe1025f21910dac
parent71cf8b8ff7d6a79af086be9e4c72628da9d62d58 (diff)
downloadkernel_samsung_aries-b9fb93047756c5e4129dfda7591612de61b0e877.zip
kernel_samsung_aries-b9fb93047756c5e4129dfda7591612de61b0e877.tar.gz
kernel_samsung_aries-b9fb93047756c5e4129dfda7591612de61b0e877.tar.bz2
perf hist: Only allocate callchain_node if processing callchains
The struct callchain_node size is 120 bytes, that are never used when there are no callchains or '-g none' is specified, so conditionally allocate it, reducing sizeof(struct hist_entry) from 210 bytes to only 96, greatly speeding the non-callchain processing. LKML-Reference: <new-submission> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-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 3819185..1fb13e5 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 f079491..18cf8b3 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 439ec5f..5bf2b74 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 {