[PATCH 31/59] perf pmu: fix alias->snapshot missing initialization bug

From: Arnaldo Carvalho de Melo
Date: Fri Jan 08 2016 - 13:22:33 EST

From: Stephane Eranian <eranian@xxxxxxxxxx>

This patch fixes a bug in __perf_pmu__new_alias() whereby the
alias->snapshot field was not initialized to false. This led to random
alias->snapshot value for an alias and was breaking some measurements
such as:

$ perf stat -a -e uncore_imc/data_reads/ -I 1000 sleep 100

Because the event ended up being treated as snapshot mode, when it is

Signed-off-by: Stephane Eranian <eranian@xxxxxxxxxx>
Cc: Andi Kleen <ak@xxxxxxxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Kan Liang <kan.liang@xxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Link: http://lkml.kernel.org/r/1452106201-13073-1-git-send-email-eranian@xxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
tools/perf/util/pmu.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index e4b173dec4b9..b597bcc8fc78 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -220,6 +220,7 @@ static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name,
alias->scale = 1.0;
alias->unit[0] = '\0';
alias->per_pkg = false;
+ alias->snapshot = false;

ret = parse_events_terms(&alias->terms, val);
if (ret) {