From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756203AbcJVIiE (ORCPT ); Sat, 22 Oct 2016 04:38:04 -0400 Received: from terminus.zytor.com ([198.137.202.10]:56932 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756109AbcJVIiC (ORCPT ); Sat, 22 Oct 2016 04:38:02 -0400 Date: Sat, 22 Oct 2016 01:37:48 -0700 From: tip-bot for Jiri Olsa Message-ID: Cc: dsahern@gmail.com, namhyung@kernel.org, hpa@zytor.com, jolsa@kernel.org, mingo@kernel.org, andi@firstfloor.org, dzickus@redhat.com, acme@redhat.com, a.p.zijlstra@chello.nl, jmario@redhat.com, linux-kernel@vger.kernel.org, tglx@linutronix.de Reply-To: mingo@kernel.org, jolsa@kernel.org, andi@firstfloor.org, namhyung@kernel.org, dsahern@gmail.com, hpa@zytor.com, acme@redhat.com, dzickus@redhat.com, linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl, jmario@redhat.com, tglx@linutronix.de To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf c2c report: Add 'offset' dimension key Git-Commit-ID: 48acdebdc328a9776017111761cd9051fe9d63ff X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 48acdebdc328a9776017111761cd9051fe9d63ff Gitweb: http://git.kernel.org/tip/48acdebdc328a9776017111761cd9051fe9d63ff Author: Jiri Olsa AuthorDate: Fri, 29 Apr 2016 14:37:06 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 19 Oct 2016 13:18:31 -0300 perf c2c report: Add 'offset' dimension key It displays cacheline offset as hex number. Signed-off-by: Jiri Olsa Cc: Andi Kleen Cc: David Ahern Cc: Don Zickus Cc: Joe Mario Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/n/tip-m0424ye98lqveg5nopto8qww@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-c2c.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 3a3e67f..01d541f 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -301,6 +301,33 @@ static int dcacheline_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, return scnprintf(hpp->buf, hpp->size, "%*s", width, HEX_STR(buf, addr)); } +static int offset_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, + struct hist_entry *he) +{ + uint64_t addr = 0; + int width = c2c_width(fmt, hpp, he->hists); + char buf[20]; + + if (he->mem_info) + addr = cl_offset(he->mem_info->daddr.al_addr); + + return scnprintf(hpp->buf, hpp->size, "%*s", width, HEX_STR(buf, addr)); +} + +static int64_t +offset_cmp(struct perf_hpp_fmt *fmt __maybe_unused, + struct hist_entry *left, struct hist_entry *right) +{ + uint64_t l = 0, r = 0; + + if (left->mem_info) + l = cl_offset(left->mem_info->daddr.addr); + if (right->mem_info) + r = cl_offset(right->mem_info->daddr.addr); + + return (int64_t)(r - l); +} + #define HEADER_LOW(__h) \ { \ .line[1] = { \ @@ -344,8 +371,17 @@ static struct c2c_dimension dim_dcacheline = { .width = 18, }; +static struct c2c_dimension dim_offset = { + .header = HEADER_BOTH("Data address", "Offset"), + .name = "offset", + .cmp = offset_cmp, + .entry = offset_entry, + .width = 18, +}; + static struct c2c_dimension *dimensions[] = { &dim_dcacheline, + &dim_offset, NULL, };