Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp107879pxy; Wed, 21 Apr 2021 20:12:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyI5q0FbXEzXq7rRUbmKoUNlMdyqXTDV0s1p4799XTQgidaXLIbzpYacWYkRkYyvG/iIcmo X-Received: by 2002:a63:6d6:: with SMTP id 205mr1361618pgg.320.1619061160796; Wed, 21 Apr 2021 20:12:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619061160; cv=none; d=google.com; s=arc-20160816; b=kKBa4+2RCJcubvoxjlMc4W1vqY0pW5udfp/SiRToYLKeDVtrTomUfMQVcbIOk+Xv+m vWRsZedDiNe9vehGyAhHTVO3Noukk78CrNEd389l5KpmOHNjL5RJuwgAR+YscnUTT3Nj qpO3EefwkwRO3/Vy8NKutCZTnVHlRMA9X9sFeQrP9PPcHsnK2zyLionwUYcoqQKKq6By Vx2pcS7LDkV7TRLhF1dAVEQ5HnqZRUwlrAauaK/k7NV+nM+BIP3nNtVMECDqG9AbIoMG 0wi6b2MCSB1kgyaQeei6m0tggVDwdNBjLGGvKyRUj5ITaPTY8IufwYiIhH/pRy0BLlwh yz5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=NwV9B701RJB9E0n7Z3cLSB6igrNccSPDBr6HfTLFVi4=; b=fV9ulDejNHFoIzcH3NpDRt7kOKANR8f5ipFgFIjSVDd+O+p4zw/CqGqY1z13/UZw70 6RcCh+JSKk15YeaGb9dP44WC5SfaKldJoruxDALLYky09GSZlnJzBRdBD1phyDyv09dy XweiaQu0HPEOja4MZU2+WSoat/EgIjwzvZZvnv9qOKwCBMfCZPfS0fGhIEFnIwhkUH6b chu03gtrIyF0MlwDlSVRW9zaik3mJXlIn5NgyYhbWkdrnWombuh7dPVVs1Er3vl1gmfl gNM7mAXCK34WZVFv7r4GOxoq2fRfgMCMtE71J/AJ3x9vMrI1MF4tj7jsE0IMEQWTfA+h zI5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q23si1820042pgt.495.2021.04.21.20.12.26; Wed, 21 Apr 2021 20:12:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234007AbhDVDLj (ORCPT + 99 others); Wed, 21 Apr 2021 23:11:39 -0400 Received: from mga05.intel.com ([192.55.52.43]:58213 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229706AbhDVDLf (ORCPT ); Wed, 21 Apr 2021 23:11:35 -0400 IronPort-SDR: RlwyIpjHr6BCMWbLdKIROEAtYAPKDHpo4SNC6PH8266P1Pqnz4Ye3k8+kAiSoCZ/SucdxWHLHG Haa0bV/401bg== X-IronPort-AV: E=McAfee;i="6200,9189,9961"; a="281147150" X-IronPort-AV: E=Sophos;i="5.82,241,1613462400"; d="scan'208";a="281147150" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2021 20:11:00 -0700 IronPort-SDR: fRAdjy9WupuSVeddIAiQlV3uBpgAyfTf6uuDaiv9baQJ/lPxOshpALS1Hb9+XZPGSDjQsQMMyE ICd0G4UUlnsA== X-IronPort-AV: E=Sophos;i="5.82,241,1613462400"; d="scan'208";a="427755221" Received: from yjin15-mobl1.ccr.corp.intel.com (HELO [10.238.4.6]) ([10.238.4.6]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2021 20:10:57 -0700 Subject: Re: [PATCH v4 15/25] perf stat: Filter out unmatched aggregation for hybrid event To: Jiri Olsa Cc: acme@kernel.org, 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: <20210416140517.18206-1-yao.jin@linux.intel.com> <20210416140517.18206-16-yao.jin@linux.intel.com> From: "Jin, Yao" Message-ID: <1da39794-bdc3-2a9d-4038-9e95e2c02660@linux.intel.com> Date: Thu, 22 Apr 2021 11:10:54 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jiri, On 4/22/2021 2:29 AM, Jiri Olsa wrote: > On Fri, Apr 16, 2021 at 10:05:07PM +0800, Jin Yao wrote: > > SNIP > >> diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c >> index 5255d78b1c30..15eafd249e46 100644 >> --- a/tools/perf/util/stat-display.c >> +++ b/tools/perf/util/stat-display.c >> @@ -643,6 +643,20 @@ static void aggr_cb(struct perf_stat_config *config, >> } >> } >> >> +static bool aggr_id_hybrid_matched(struct perf_stat_config *config, >> + struct evsel *counter, struct aggr_cpu_id id) >> +{ >> + struct aggr_cpu_id s; >> + >> + for (int i = 0; i < evsel__nr_cpus(counter); i++) { >> + s = config->aggr_get_id(config, evsel__cpus(counter), i); >> + if (cpu_map__compare_aggr_cpu_id(s, id)) >> + return true; >> + } >> + >> + return false; >> +} >> + >> static void print_counter_aggrdata(struct perf_stat_config *config, >> struct evsel *counter, int s, >> char *prefix, bool metric_only, >> @@ -656,6 +670,12 @@ static void print_counter_aggrdata(struct perf_stat_config *config, >> double uval; >> >> ad.id = id = config->aggr_map->map[s]; >> + >> + if (perf_pmu__has_hybrid() && >> + !aggr_id_hybrid_matched(config, counter, id)) { >> + return; >> + } >> + >> ad.val = ad.ena = ad.run = 0; >> ad.nr = 0; >> if (!collect_data(config, counter, aggr_cb, &ad)) > > there's same check in aggr_cb, so it seems like we could just make check in here: > > if (perf_pmu__has_hybrid() && ad.ena == 0) > return; > > without another extra loop > > jirka > I guess you recommended the patch like this: static void print_counter_aggrdata(struct perf_stat_config *config, struct evsel *counter, int s, char *prefix, bool metric_only, @@ -670,17 +656,14 @@ static void print_counter_aggrdata(struct perf_stat_config *config, double uval; ad.id = id = config->aggr_map->map[s]; ad.val = ad.ena = ad.run = 0; ad.nr = 0; if (!collect_data(config, counter, aggr_cb, &ad)) return; + if (perf_pmu__has_hybrid() && ad.ena == 0) + return; + nr = ad.nr; ena = ad.ena; run = ad.run; Yes, it works. The test log is, # perf stat --per-core -e cpu_core/cycles/ -a -- sleep 1 Performance counter stats for 'system wide': S0-D0-C0 2 2,341,923 cpu_core/cycles/ S0-D0-C4 2 1,707,933 cpu_core/cycles/ S0-D0-C8 2 845,805 cpu_core/cycles/ S0-D0-C12 2 1,001,961 cpu_core/cycles/ S0-D0-C16 2 932,004 cpu_core/cycles/ S0-D0-C20 2 1,778,603 cpu_core/cycles/ S0-D0-C24 2 804,448 cpu_core/cycles/ S0-D0-C28 2 178,360 cpu_core/cycles/ 1.002264168 seconds time elapsed Thanks Jin Yao