Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1073924pxy; Thu, 22 Apr 2021 22:39:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUMxqouleAPqoLNsq9VsHB8ROKybjZMG1g85wxCvgmvaz0NXFU1cuGclGN/irHa69uN57E X-Received: by 2002:a17:906:584b:: with SMTP id h11mr2286900ejs.463.1619156356418; Thu, 22 Apr 2021 22:39:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619156356; cv=none; d=google.com; s=arc-20160816; b=0jpCXvI8DujCm2F6SS7SgGpx5vaquSY2jG7bmkGzNHgqk/xwZJBY03+jrvPHdeyeMC Ax5ec3mttusHp6L7Iie+UCwzCKXuKAF+Jv1tvTtvfya+/YnKqzDJJ6cHyfT+mdICYgjD vRj4dsXHK0rPVMkt4mUCc5Zx7+C2Spou148uIsPdK3tgBV1GnZlLrD1lI6zTKdn+mveC NCqpfWxAP0PfI1W5GAfyAbz+NPZDBwqeI4Q4AqhRio9gZSSlB9gKoAStCT61dm4l0Rqo 73o5JJtwjBf+4qE+L26IvjNEFceAmmr0/PYReDhYtiw3AWC1j16xseFRj274opyDKkH/ N1Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:ironport-sdr:ironport-sdr; bh=jHuGlDm3eewll1OmJPMRlGUCHGLwZU/JyNdVm+UcBXo=; b=nRxwxk+Vq/5yCg++rntxPGJTIXz1Nim4Ti8zEhE3vH3assZ+YchnkGmZfkEZE05Fah XkKJ0iZLD7hGiNKd8m/8WyWf4s6rgv0Q/nwx7d7p3YghFaiIb0ETSXueScrA9bpsS2+S aeC5/lWz5DWhrvladXX1U5WWnT56gvmnaEzv15y9vduJzFiZaZotRDXy0rlsPz6on8cz 35Yb+YL78B7fdRKnETa2ymzLNO3U7pr5Ny21hYGbih6bBmszZXB4GEk494imJM1dLDYy P7sgu0cYger9Q7yY1Bz2G6s4j4T0s4YbJcurf2j3CqmOsaVGIS2jGdjxM6tNV16YTpNY TNGg== 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 w22si4604552edc.204.2021.04.22.22.38.53; Thu, 22 Apr 2021 22:39:16 -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 S240918AbhDWFiP (ORCPT + 99 others); Fri, 23 Apr 2021 01:38:15 -0400 Received: from mga18.intel.com ([134.134.136.126]:9339 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240701AbhDWFhy (ORCPT ); Fri, 23 Apr 2021 01:37:54 -0400 IronPort-SDR: bvCdRsNfmXQv3sSR+Y7aK/4aXgOFDN7xTwy52PtwzyBx/dSIJGokflHxRxDVUn4hKhCaAQ+Bg4 y3PZKM97YcsQ== X-IronPort-AV: E=McAfee;i="6200,9189,9962"; a="183501838" X-IronPort-AV: E=Sophos;i="5.82,244,1613462400"; d="scan'208";a="183501838" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2021 22:37:17 -0700 IronPort-SDR: BTq5gqpjcmWu0r/j5IeRvIPOYHX95ii1yd/rNGy2Lp1pUL5aW5QiGvzRquPVJFoY/CAT8ecXKd Yqv8hMcoIohQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,244,1613462400"; d="scan'208";a="386293674" Received: from kbl-ppc.sh.intel.com ([10.239.159.163]) by orsmga006.jf.intel.com with ESMTP; 22 Apr 2021 22:37:14 -0700 From: Jin Yao To: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com Cc: Linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com, Jin Yao Subject: [PATCH v5 15/26] perf stat: Filter out unmatched aggregation for hybrid event Date: Fri, 23 Apr 2021 13:35:30 +0800 Message-Id: <20210423053541.12521-16-yao.jin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210423053541.12521-1-yao.jin@linux.intel.com> References: <20210423053541.12521-1-yao.jin@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org perf-stat has supported some aggregation modes, such as --per-core, --per-socket and etc. While for hybrid event, it may only available on part of cpus. So for --per-core, we need to filter out the unavailable cores, for --per-socket, filter out the unavailable sockets, and so on. Before: # perf stat --per-core -e cpu_core/cycles/ -a -- sleep 1 Performance counter stats for 'system wide': S0-D0-C0 2 479,530 cpu_core/cycles/ S0-D0-C4 2 175,007 cpu_core/cycles/ S0-D0-C8 2 166,240 cpu_core/cycles/ S0-D0-C12 2 704,673 cpu_core/cycles/ S0-D0-C16 2 865,835 cpu_core/cycles/ S0-D0-C20 2 2,958,461 cpu_core/cycles/ S0-D0-C24 2 163,988 cpu_core/cycles/ S0-D0-C28 2 164,729 cpu_core/cycles/ S0-D0-C32 0 cpu_core/cycles/ S0-D0-C33 0 cpu_core/cycles/ S0-D0-C34 0 cpu_core/cycles/ S0-D0-C35 0 cpu_core/cycles/ S0-D0-C36 0 cpu_core/cycles/ S0-D0-C37 0 cpu_core/cycles/ S0-D0-C38 0 cpu_core/cycles/ S0-D0-C39 0 cpu_core/cycles/ 1.003597211 seconds time elapsed After: # perf stat --per-core -e cpu_core/cycles/ -a -- sleep 1 Performance counter stats for 'system wide': S0-D0-C0 2 210,428 cpu_core/cycles/ S0-D0-C4 2 444,830 cpu_core/cycles/ S0-D0-C8 2 435,241 cpu_core/cycles/ S0-D0-C12 2 423,976 cpu_core/cycles/ S0-D0-C16 2 859,350 cpu_core/cycles/ S0-D0-C20 2 1,559,589 cpu_core/cycles/ S0-D0-C24 2 163,924 cpu_core/cycles/ S0-D0-C28 2 376,610 cpu_core/cycles/ 1.003621290 seconds time elapsed Signed-off-by: Jin Yao Co-developed-by: Jiri Olsa --- v5: - Use Jiri's code to filter, which is much simpler than original. v4: - No change. tools/perf/util/stat-display.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index 5255d78b1c30..06689f128e56 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -661,6 +661,9 @@ static void print_counter_aggrdata(struct perf_stat_config *config, 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; -- 2.17.1