From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757532AbcIVPtN (ORCPT ); Thu, 22 Sep 2016 11:49:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42896 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753266AbcIVPiT (ORCPT ); Thu, 22 Sep 2016 11:38:19 -0400 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Don Zickus , Joe Mario , Ingo Molnar , Peter Zijlstra , Namhyung Kim , David Ahern , Andi Kleen Subject: [PATCH 22/57] perf c2c report: Add iaddr dimension key Date: Thu, 22 Sep 2016 17:36:50 +0200 Message-Id: <1474558645-19956-23-git-send-email-jolsa@kernel.org> In-Reply-To: <1474558645-19956-1-git-send-email-jolsa@kernel.org> References: <1474558645-19956-1-git-send-email-jolsa@kernel.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 22 Sep 2016 15:38:18 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding iaddr dimension key support. It displays 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. Link: http://lkml.kernel.org/n/tip-rhshygbst6kr75kju0muwt5x@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/builtin-c2c.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 7c52481ec36b..a2881677c315 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -326,6 +326,26 @@ 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); + + if (he->mem_info) + addr = he->mem_info->iaddr.addr; + + return snprintf(hpp->buf, hpp->size, "%*s", width, hex_str(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] = { \ @@ -377,9 +397,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