perf hist: Simplify the insertion of new hist_entry instances
And with that fix at least one bug:
The first hit for an entry, the one that calls malloc to create a new
instance in __perf_session__add_hist_entry, wasn't adding the count to
the per cpumode (PERF_RECORD_MISC_USER, etc) total variable.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index ee154b5..c7ac45a 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -72,8 +72,6 @@
struct sym_priv *priv;
struct sym_hist *h;
- he->count++;
-
if (!sym || !he->ms.map)
return 0;
@@ -99,9 +97,8 @@
}
static int perf_session__add_hist_entry(struct perf_session *self,
- struct addr_location *al, u64 count)
+ struct addr_location *al)
{
- bool hit;
struct hist_entry *he;
if (sym_hist_filter != NULL &&
@@ -115,7 +112,7 @@
return 0;
}
- he = __perf_session__add_hist_entry(&self->hists, al, NULL, count, &hit);
+ he = __perf_session__add_hist_entry(&self->hists, al, NULL, 1);
if (he == NULL)
return -ENOMEM;
@@ -135,7 +132,7 @@
return -1;
}
- if (!al.filtered && perf_session__add_hist_entry(session, &al, 1)) {
+ if (!al.filtered && perf_session__add_hist_entry(session, &al)) {
pr_warning("problem incrementing symbol count, "
"skipping event\n");
return -1;