From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755452AbcETKXf (ORCPT ); Fri, 20 May 2016 06:23:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54539 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755016AbcETKXa (ORCPT ); Fri, 20 May 2016 06:23:30 -0400 Date: Fri, 20 May 2016 12:23:27 +0200 From: Jiri Olsa To: Andi Kleen Cc: acme@kernel.org, peterz@infradead.org, jolsa@kernel.org, mingo@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: [PATCH 8/8] perf stat: Add computation of TopDown formulas Message-ID: <20160520102327.GB28818@krava> References: <1463190297-17408-1-git-send-email-andi@firstfloor.org> <1463190297-17408-9-git-send-email-andi@firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1463190297-17408-9-git-send-email-andi@firstfloor.org> User-Agent: Mutt/1.6.1 (2016-04-27) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 20 May 2016 10:23:30 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 13, 2016 at 06:44:57PM -0700, Andi Kleen wrote: > From: Andi Kleen > > Implement the TopDown formulas in perf stat. The topdown basic metrics > reported by the kernel are collected, and the formulas are computed > and output as normal metrics. > > See the kernel commit exporting the events for details on the used > metrics. > > v2: Always print all metrics, only use thresholds for coloring. > v3: Mark retiring over threshold green, not red. > v4: > Only print one decimal digit > Fix color printing of one metric > Signed-off-by: Andi Kleen > --- > tools/perf/util/stat-shadow.c | 156 ++++++++++++++++++++++++++++++++++++++++++ > tools/perf/util/stat.c | 5 ++ > tools/perf/util/stat.h | 5 ++ > 3 files changed, 166 insertions(+) > > diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c > index fdb71961143e..182050f2785a 100644 > --- a/tools/perf/util/stat-shadow.c > +++ b/tools/perf/util/stat-shadow.c > @@ -36,6 +36,11 @@ static struct stats runtime_dtlb_cache_stats[NUM_CTX][MAX_NR_CPUS]; > static struct stats runtime_cycles_in_tx_stats[NUM_CTX][MAX_NR_CPUS]; > static struct stats runtime_transaction_stats[NUM_CTX][MAX_NR_CPUS]; > static struct stats runtime_elision_stats[NUM_CTX][MAX_NR_CPUS]; > +static struct stats runtime_topdown_total_slots[NUM_CTX][MAX_NR_CPUS]; > +static struct stats runtime_topdown_slots_issued[NUM_CTX][MAX_NR_CPUS]; > +static struct stats runtime_topdown_slots_retired[NUM_CTX][MAX_NR_CPUS]; > +static struct stats runtime_topdown_fetch_bubbles[NUM_CTX][MAX_NR_CPUS]; > +static struct stats runtime_topdown_recovery_bubbles[NUM_CTX][MAX_NR_CPUS]; > static bool have_frontend_stalled; > > struct stats walltime_nsecs_stats; > @@ -82,6 +87,12 @@ void perf_stat__reset_shadow_stats(void) > sizeof(runtime_transaction_stats)); > memset(runtime_elision_stats, 0, sizeof(runtime_elision_stats)); > memset(&walltime_nsecs_stats, 0, sizeof(walltime_nsecs_stats)); > + memset(runtime_topdown_total_slots, 0, sizeof(runtime_topdown_total_slots)); > + memset(runtime_topdown_slots_retired, 0, sizeof(runtime_topdown_slots_retired)); > + memset(runtime_topdown_slots_issued, 0, sizeof(runtime_topdown_slots_issued)); > + memset(runtime_topdown_fetch_bubbles, 0, sizeof(runtime_topdown_fetch_bubbles)); > + memset(runtime_topdown_recovery_bubbles, 0, sizeof(runtime_topdown_recovery_bubbles)); > + have_frontend_stalled = pmu_have_event("cpu", "stalled-cycles-frontend"); why to initialize this one in here? it's already in perf_stat__init_shadow_stats jirka