diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index e77880b5094ded75ac4975d4212f9e35bb9cfa2f..df2fbf046ee2b5ae9b358feef28bb04e83fcd629 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -161,6 +161,13 @@ static int create_perf_stat_counter(struct perf_evsel *evsel) attr->inherit = !no_inherit; + /* + * Some events get initialized with sample_(period/type) set, + * like tracepoints. Clear it up for counting. + */ + attr->sample_period = 0; + attr->sample_type = 0; + if (target__has_cpu(&target)) return perf_evsel__open_per_cpu(evsel, perf_evsel__cpus(evsel));