From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965484AbcJTPQm (ORCPT ); Thu, 20 Oct 2016 11:16:42 -0400 Received: from merlin.infradead.org ([205.233.59.134]:40474 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755543AbcJTPEt (ORCPT ); Thu, 20 Oct 2016 11:04:49 -0400 From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, Linux Weekly News , Jiri Olsa , Andi Kleen , David Ahern , Don Zickus , Joe Mario , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo Subject: [PATCH 15/52] perf c2c report: Add 'iaddr' dimension key Date: Thu, 20 Oct 2016 12:03:59 -0300 Message-Id: <1476975876-2522-16-git-send-email-acme@kernel.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476975876-2522-1-git-send-email-acme@kernel.org> References: <1476975876-2522-1-git-send-email-acme@kernel.org> X-SRS-Rewrite: SMTP reverse-path rewritten from by merlin.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiri Olsa It displays the code address (as hex number) responsible for the accesses. Using c2c wrapper to standard 'symbol_iaddr' object to define own header and simple (just address) code address 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/n/tip-rhshygbst6kr75kju0muwt5x@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-c2c.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 01d541fd7022..bb9d01874836 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -328,6 +328,27 @@ offset_cmp(struct perf_hpp_fmt *fmt __maybe_unused, return (int64_t)(r - l); } +static int +iaddr_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 = he->mem_info->iaddr.addr; + + return scnprintf(hpp->buf, hpp->size, "%*s", width, HEX_STR(buf, addr)); +} + +static int64_t +iaddr_cmp(struct perf_hpp_fmt *fmt __maybe_unused, + struct hist_entry *left, struct hist_entry *right) +{ + return sort__iaddr_cmp(left, right); +} + #define HEADER_LOW(__h) \ { \ .line[1] = { \ @@ -379,9 +400,18 @@ static struct c2c_dimension dim_offset = { .width = 18, }; +static struct c2c_dimension dim_iaddr = { + .header = HEADER_LOW("Code address"), + .name = "iaddr", + .cmp = iaddr_cmp, + .entry = iaddr_entry, + .width = 18, +}; + static struct c2c_dimension *dimensions[] = { &dim_dcacheline, &dim_offset, + &dim_iaddr, NULL, }; -- 2.7.4