From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751582AbdLBEjS (ORCPT ); Fri, 1 Dec 2017 23:39:18 -0500 Received: from mga09.intel.com ([134.134.136.24]:50153 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751373AbdLBEjR (ORCPT ); Fri, 1 Dec 2017 23:39:17 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,348,1508828400"; d="scan'208";a="1250966276" Subject: Re: [PATCH v5 02/12] perf util: Define a structure for runtime shadow stats To: Arnaldo Carvalho de Melo Cc: jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com References: <1512125856-22056-1-git-send-email-yao.jin@linux.intel.com> <1512125856-22056-3-git-send-email-yao.jin@linux.intel.com> <20171201140214.GV3298@kernel.org> From: "Jin, Yao" Message-ID: <74620284-eff8-ec87-c424-5fc4cc6573c8@linux.intel.com> Date: Sat, 2 Dec 2017 12:39:13 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171201140214.GV3298@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/1/2017 10:02 PM, Arnaldo Carvalho de Melo wrote: > Em Fri, Dec 01, 2017 at 06:57:26PM +0800, Jin Yao escreveu: >> Perf has a set of static variables to record the runtime shadow >> metrics stats. >> >> While if we want to record the runtime shadow stats for per-thread, >> it will be the limitation. This patch creates a structure and the >> next patches will use this structure to update the runtime shadow >> stats for per-thread. >> >> Signed-off-by: Jin Yao >> --- >> tools/perf/util/stat-shadow.c | 11 ----------- >> tools/perf/util/stat.h | 44 ++++++++++++++++++++++++++++++++++++++++++- >> 2 files changed, 43 insertions(+), 12 deletions(-) >> >> diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c >> index 855e35c..5853901 100644 >> --- a/tools/perf/util/stat-shadow.c >> +++ b/tools/perf/util/stat-shadow.c >> @@ -9,17 +9,6 @@ >> #include "expr.h" >> #include "metricgroup.h" >> >> -enum { >> - CTX_BIT_USER = 1 << 0, >> - CTX_BIT_KERNEL = 1 << 1, >> - CTX_BIT_HV = 1 << 2, >> - CTX_BIT_HOST = 1 << 3, >> - CTX_BIT_IDLE = 1 << 4, >> - CTX_BIT_MAX = 1 << 5, >> -}; >> - >> -#define NUM_CTX CTX_BIT_MAX >> - >> /* >> * AGGR_GLOBAL: Use CPU 0 >> * AGGR_SOCKET: Use first CPU of socket >> diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h >> index eefca5c..290c51e 100644 >> --- a/tools/perf/util/stat.h >> +++ b/tools/perf/util/stat.h >> @@ -5,6 +5,8 @@ >> #include >> #include >> #include "xyarray.h" >> +#include "evsel.h" > > What is this for? You don't add anything in this patch that uses things > from evsel.h. > > I'm removing it, will fixup if later this becomes needed. > > - Arnaldo > That's fine, thanks Arnaldo! Thanks Jin Yao >> +#include "rblist.h" >> >> struct stats >> { >> @@ -43,6 +45,47 @@ enum aggr_mode { >> AGGR_UNSET, >> }; >> >> +enum { >> + CTX_BIT_USER = 1 << 0, >> + CTX_BIT_KERNEL = 1 << 1, >> + CTX_BIT_HV = 1 << 2, >> + CTX_BIT_HOST = 1 << 3, >> + CTX_BIT_IDLE = 1 << 4, >> + CTX_BIT_MAX = 1 << 5, >> +}; >> + >> +#define NUM_CTX CTX_BIT_MAX >> + >> +enum stat_type { >> + STAT_NONE = 0, >> + STAT_NSECS, >> + STAT_CYCLES, >> + STAT_STALLED_CYCLES_FRONT, >> + STAT_STALLED_CYCLES_BACK, >> + STAT_BRANCHES, >> + STAT_CACHEREFS, >> + STAT_L1_DCACHE, >> + STAT_L1_ICACHE, >> + STAT_LL_CACHE, >> + STAT_ITLB_CACHE, >> + STAT_DTLB_CACHE, >> + STAT_CYCLES_IN_TX, >> + STAT_TRANSACTION, >> + STAT_ELISION, >> + STAT_TOPDOWN_TOTAL_SLOTS, >> + STAT_TOPDOWN_SLOTS_ISSUED, >> + STAT_TOPDOWN_SLOTS_RETIRED, >> + STAT_TOPDOWN_FETCH_BUBBLES, >> + STAT_TOPDOWN_RECOVERY_BUBBLES, >> + STAT_SMI_NUM, >> + STAT_APERF, >> + STAT_MAX >> +}; >> + >> +struct runtime_stat { >> + struct rblist value_list; >> +}; >> + >> struct perf_stat_config { >> enum aggr_mode aggr_mode; >> bool scale; >> @@ -92,7 +135,6 @@ struct perf_stat_output_ctx { >> bool force_header; >> }; >> >> -struct rblist; >> void perf_stat__print_shadow_stats(struct perf_evsel *evsel, >> double avg, int cpu, >> struct perf_stat_output_ctx *out, >> -- >> 2.7.4