aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/hist.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-05-14 09:36:42 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-05-14 09:36:42 -0400
commitc8446b9bdabcb0caa61bb341bd73c58f7104b503 (patch)
treeb2530bfbbd893017e9515bd48f2ffa8845860759 /tools/perf/util/hist.c
parent5d2be7cb198a0a6bc6088d3806fb7261b184ad89 (diff)
perf hist: Make event__totals per hists
This is one more thing that started global but are more useful per hist or per session. 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>
Diffstat (limited to 'tools/perf/util/hist.c')
-rw-r--r--tools/perf/util/hist.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 5dc4f8429eda..1614ad710046 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -1028,3 +1028,24 @@ int hist_entry__annotate(struct hist_entry *self, struct list_head *head)
1028 pclose(file); 1028 pclose(file);
1029 return 0; 1029 return 0;
1030} 1030}
1031
1032void hists__inc_nr_events(struct hists *self, u32 type)
1033{
1034 ++self->hists.stats.nr_events[0];
1035 ++self->hists.stats.nr_events[type];
1036}
1037
1038size_t hists__fprintf_nr_events(struct hists *self, FILE *fp)
1039{
1040 int i;
1041 size_t ret = 0;
1042
1043 for (i = 0; i < PERF_RECORD_HEADER_MAX; ++i) {
1044 if (!event__name[i])
1045 continue;
1046 ret += fprintf(fp, "%10s events: %10d\n",
1047 event__name[i], self->stats.nr_events[i]);
1048 }
1049
1050 return ret;
1051}