Skip to contentSkip to conversation

perf annotate: Do not overwrite perf_sample->weight

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Jul 30, 2017 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  c6c13be76c1fc8a3169dbd29cd1d42af1d64773f
Gitweb:     http://git.kernel.org/tip/c6c13be76c1fc8a3169dbd29cd1d42af1d64773f
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Wed, 26 Jul 2017 16:52:25 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 26 Jul 2017 16:52:25 -0300

perf annotate: Do not overwrite perf_sample->weight

When we parse an event we may get a value from the kernel in response to PERF_SAMPLE_WEIGHT being set in perf_event_attr->sample_type, and if it is not set, then perf_sample->weight will be set to zero, which should be ok according to a discussion with Andi Kleen [1]:

1: https://lkml.kernel.org/r/[email protected]

---
 tools/perf/builtin-annotate.c | 2 --
 1 file changed, 2 deletions(-)
tools/perf/builtin-annotate.c +0 -2
index 6db782d..658c920 100644
@@ -177,8 +177,6 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel,
 	 */
 	process_branch_stack(sample->branch_stack, al, sample);
 
-	sample->weight = 1;
-
 	he = hists__add_entry(hists, al, NULL, NULL, NULL, sample, true);
 	if (he == NULL)
 		return -ENOMEM;