From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936498AbcJVImI (ORCPT ); Sat, 22 Oct 2016 04:42:08 -0400 Received: from terminus.zytor.com ([198.137.202.10]:57178 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932247AbcJVImE (ORCPT ); Sat, 22 Oct 2016 04:42:04 -0400 Date: Sat, 22 Oct 2016 01:41:51 -0700 From: tip-bot for Jiri Olsa Message-ID: Cc: andi@firstfloor.org, jolsa@kernel.org, tglx@linutronix.de, hpa@zytor.com, a.p.zijlstra@chello.nl, linux-kernel@vger.kernel.org, namhyung@kernel.org, dsahern@gmail.com, jmario@redhat.com, acme@redhat.com, dzickus@redhat.com, mingo@kernel.org Reply-To: acme@redhat.com, dzickus@redhat.com, mingo@kernel.org, andi@firstfloor.org, jolsa@kernel.org, hpa@zytor.com, tglx@linutronix.de, a.p.zijlstra@chello.nl, jmario@redhat.com, namhyung@kernel.org, dsahern@gmail.com, linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf c2c report: Add total loads sort key Git-Commit-ID: 55177c4ea6696332e2de44370eed3a62d7fceb67 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: 55177c4ea6696332e2de44370eed3a62d7fceb67 Gitweb: http://git.kernel.org/tip/55177c4ea6696332e2de44370eed3a62d7fceb67 Author: Jiri Olsa AuthorDate: Thu, 19 May 2016 09:52:37 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 19 Oct 2016 13:18:31 -0300 perf c2c report: Add total loads sort key It is to be displayed in the main cachelines overall output: tot_loads It displays sum of all load accesses for cacheline. 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-czd17qsh5u5z0yc1estz9l2y@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-c2c.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index ff5b5b8..2411fe0 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -514,6 +514,57 @@ tot_recs_cmp(struct perf_hpp_fmt *fmt __maybe_unused, return tot_recs_left - tot_recs_right; } +static uint64_t total_loads(struct c2c_stats *stats) +{ + uint64_t lclmiss, ldcnt; + + lclmiss = stats->lcl_dram + + stats->rmt_dram + + stats->rmt_hitm + + stats->rmt_hit; + + ldcnt = lclmiss + + stats->ld_fbhit + + stats->ld_l1hit + + stats->ld_l2hit + + stats->ld_llchit + + stats->lcl_hitm; + + return ldcnt; +} + +static int +tot_loads_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, + struct hist_entry *he) +{ + struct c2c_hist_entry *c2c_he; + int width = c2c_width(fmt, hpp, he->hists); + uint64_t tot_recs; + + c2c_he = container_of(he, struct c2c_hist_entry, he); + tot_recs = total_loads(&c2c_he->stats); + + return scnprintf(hpp->buf, hpp->size, "%*" PRIu64, width, tot_recs); +} + +static int64_t +tot_loads_cmp(struct perf_hpp_fmt *fmt __maybe_unused, + struct hist_entry *left, struct hist_entry *right) +{ + struct c2c_hist_entry *c2c_left; + struct c2c_hist_entry *c2c_right; + uint64_t tot_recs_left; + uint64_t tot_recs_right; + + c2c_left = container_of(left, struct c2c_hist_entry, he); + c2c_right = container_of(right, struct c2c_hist_entry, he); + + tot_recs_left = total_loads(&c2c_left->stats); + tot_recs_right = total_loads(&c2c_right->stats); + + return tot_recs_left - tot_recs_right; +} + #define HEADER_LOW(__h) \ { \ .line[1] = { \ @@ -709,6 +760,14 @@ static struct c2c_dimension dim_tot_recs = { .width = 7, }; +static struct c2c_dimension dim_tot_loads = { + .header = HEADER_BOTH("Total", "Loads"), + .name = "tot_loads", + .cmp = tot_loads_cmp, + .entry = tot_loads_entry, + .width = 7, +}; + static struct c2c_dimension *dimensions[] = { &dim_dcacheline, &dim_offset, @@ -730,6 +789,7 @@ static struct c2c_dimension *dimensions[] = { &dim_ld_rmthit, &dim_ld_llcmiss, &dim_tot_recs, + &dim_tot_loads, NULL, };