From: Arnaldo Carvalho de Melo Date: Fri, 28 Jul 2017 15:49:02 +0000 (-0300) Subject: perf annotate: Fix storing per line sym_hist_entry X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=48cc33085253d607706e68a67ac98fe2a6abdd3d;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git perf annotate: Fix storing per line sym_hist_entry The existing loop incremented the offset while using it as the array index, when we went to an array of sym_hist_entry instances, we should've moved the increment to outside of the array element reference, oops, fix it. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Taeung Song Cc: Wang Nan Fixes: 461c17f00f40 ("perf annotate: Store the sample period in each histogram bucket") Link: http://lkml.kernel.org/n/tip-s3dm6uyrazlpag3f0psfia07@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 5125c2bbacaa..2dab0e5a7f2f 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -963,8 +963,9 @@ double disasm__calc_percent(struct annotation *notes, int evidx, s64 offset, u64 period = 0; while (offset < end) { - hits += h->addr[offset++].nr_samples; - period += h->addr[offset++].period; + hits += h->addr[offset].nr_samples; + period += h->addr[offset].period; + ++offset; } if (h->nr_samples) {