From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756167AbcJVIhz (ORCPT ); Sat, 22 Oct 2016 04:37:55 -0400 Received: from terminus.zytor.com ([198.137.202.10]:56916 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753510AbcJVIhw (ORCPT ); Sat, 22 Oct 2016 04:37:52 -0400 Date: Sat, 22 Oct 2016 01:37:19 -0700 From: tip-bot for Jiri Olsa Message-ID: Cc: tglx@linutronix.de, dsahern@gmail.com, hpa@zytor.com, acme@redhat.com, jmario@redhat.com, jolsa@kernel.org, mingo@kernel.org, namhyung@kernel.org, a.p.zijlstra@chello.nl, linux-kernel@vger.kernel.org, andi@firstfloor.org, dzickus@redhat.com Reply-To: linux-kernel@vger.kernel.org, andi@firstfloor.org, dzickus@redhat.com, mingo@kernel.org, a.p.zijlstra@chello.nl, namhyung@kernel.org, acme@redhat.com, jolsa@kernel.org, jmario@redhat.com, tglx@linutronix.de, hpa@zytor.com, dsahern@gmail.com In-Reply-To: <1474558645-19956-21-git-send-email-jolsa@kernel.org> References: <1474558645-19956-21-git-send-email-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf c2c report: Add 'dcacheline' dimension key Git-Commit-ID: cbb88500a7698bbe8751f01222081fa7f0641fd9 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: cbb88500a7698bbe8751f01222081fa7f0641fd9 Gitweb: http://git.kernel.org/tip/cbb88500a7698bbe8751f01222081fa7f0641fd9 Author: Jiri Olsa AuthorDate: Thu, 22 Sep 2016 17:36:48 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 19 Oct 2016 13:18:31 -0300 perf c2c report: Add 'dcacheline' dimension key It displays cacheline address as hex number. Using c2c wrapper to standard 'dcacheline' object to defined own header and simple (just address) cacheline output. 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/r/1474558645-19956-21-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-c2c.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 78addc4..3a3e67f 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -1,5 +1,6 @@ #include #include +#include #include "util.h" #include "debug.h" #include "builtin.h" @@ -7,6 +8,7 @@ #include "mem-events.h" #include "session.h" #include "hist.h" +#include "sort.h" #include "tool.h" #include "data.h" #include "sort.h" @@ -273,6 +275,32 @@ static int c2c_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, return scnprintf(hpp->buf, hpp->size, "%*s", width, text); } +#define HEX_STR(__s, __v) \ +({ \ + scnprintf(__s, sizeof(__s), "0x%" PRIx64, __v); \ + __s; \ +}) + +static int64_t +dcacheline_cmp(struct perf_hpp_fmt *fmt __maybe_unused, + struct hist_entry *left, struct hist_entry *right) +{ + return sort__dcacheline_cmp(left, right); +} + +static int dcacheline_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_address(he->mem_info->daddr.addr); + + return scnprintf(hpp->buf, hpp->size, "%*s", width, HEX_STR(buf, addr)); +} + #define HEADER_LOW(__h) \ { \ .line[1] = { \ @@ -308,7 +336,16 @@ static int c2c_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, }, \ } +static struct c2c_dimension dim_dcacheline = { + .header = HEADER_LOW("Cacheline"), + .name = "dcacheline", + .cmp = dcacheline_cmp, + .entry = dcacheline_entry, + .width = 18, +}; + static struct c2c_dimension *dimensions[] = { + &dim_dcacheline, NULL, };