aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/hist.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2010-12-07 12:48:42 +0000
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-12-09 11:15:07 -0200
commit3835bc00c5b2d8e337a6e9d7b44f47e02760dba3 (patch)
treec93ec68b81e3c44c0d6e42d9e2bdeebf38657205 /tools/perf/util/hist.c
parentperf report: Allow user to specify path to kallsyms file (diff)
downloadlinux-dev-3835bc00c5b2d8e337a6e9d7b44f47e02760dba3.tar.xz
linux-dev-3835bc00c5b2d8e337a6e9d7b44f47e02760dba3.zip
perf event: Prevent unbound event__name array access
event__name[] is missing an entry for PERF_RECORD_FINISHED_ROUND, but we happily access the array from the dump code. Make event__name[] static and provide an accessor function, fix up all callers and add the missing string. Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ian Munsie <imunsie@au1.ibm.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <peterz@infradead.org> LKML-Reference: <20101207124550.432593943@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/hist.c')
-rw-r--r--tools/perf/util/hist.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 2022e8740994..a3b84160c42e 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -1168,10 +1168,13 @@ size_t hists__fprintf_nr_events(struct hists *self, FILE *fp)
size_t ret = 0;
for (i = 0; i < PERF_RECORD_HEADER_MAX; ++i) {
- if (!event__name[i])
+ const char *name = event__get_event_name(i);
+
+ if (!strcmp(name, "UNKNOWN"))
continue;
- ret += fprintf(fp, "%10s events: %10d\n",
- event__name[i], self->stats.nr_events[i]);
+
+ ret += fprintf(fp, "%16s events: %10d\n", name,
+ self->stats.nr_events[i]);
}
return ret;