All of lore.kernel.org
 help / color / mirror / Atom feed
* [tip:perf/core] perf annotate: Fix storing per line sym_hist_entry
@ 2017-07-30  9:40 tip-bot for Arnaldo Carvalho de Melo
  0 siblings, 0 replies; only message in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2017-07-30  9:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: treeze.taeung, wangnan0, acme, tglx, linux-kernel, hpa, mingo,
	adrian.hunter, namhyung, jolsa, dsahern

Commit-ID:  48cc33085253d607706e68a67ac98fe2a6abdd3d
Gitweb:     http://git.kernel.org/tip/48cc33085253d607706e68a67ac98fe2a6abdd3d
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Fri, 28 Jul 2017 12:49:02 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 28 Jul 2017 12:53:05 -0300

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 <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Taeung Song <treeze.taeung@gmail.com>
Cc: Wang Nan <wangnan0@huawei.com>
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 <acme@redhat.com>
---
 tools/perf/util/annotate.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 5125c2b..2dab0e5 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) {

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-07-30  9:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-30  9:40 [tip:perf/core] perf annotate: Fix storing per line sym_hist_entry tip-bot for Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.