Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp54018pxy; Wed, 21 Apr 2021 18:17:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuB18fUCP0ryelJM04DFSEQ2/2uWXA7vc2QmTcVT47B3B15aIeCZEW8hieytNszKdCRZ09 X-Received: by 2002:a17:90b:228a:: with SMTP id kx10mr1115140pjb.33.1619054258999; Wed, 21 Apr 2021 18:17:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619054258; cv=none; d=google.com; s=arc-20160816; b=xxvKAmCYyXyKQSQ7YkIj/em5TlenijNRwHmCUMVYqsYCrXIs4fdgVcFxhQCxCeYStn Xw5Lu6S8g6rdZRmE1jEXKcIeZPDIdptf5EIzSftu1XAkUibt7TYGTRMuKPgcqZao7z7h g/7y/pTCyvvDEEqbmo0/auJ3Ixo6hfR2z9ZsPyuwh4wl51fWJUEu7gZ2nY+9ec5jVc+i nwrUGex3RGzQRUSVS5x7NGgUlaYCyb+LjTusF28vEnZavbKLmv2Uvclth4J0iiBYn2Ob /A5oBF0e4cMI3VtZZ+XmFcL3B339i+FPWCJFY5S7Kj4D65YE0EFcL/+jNthnxW//YcMh WY9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=VtGtYNFtNAebLz2pgKqQah+fAXQ7o/bJBdongF2UrwY=; b=TPJ5aSG1ZChL/H7I5RE8uevqEiZ8HAidRLJLyypy+Rg13PDy/0dPQChTaEr2XPEic3 rcbNy01BdI+FUYMUPeNgxuWBTmUlzh0IifSO6TtsjlobjeOqYZPCnK+dTJBI3yjULoi2 AXAICF5UPNPeiMlVSQuLu/fh9XEPWL9W1yHcDNJZOBGoqX17FGJiIa1bkAGNWCQWyY6e +M1BdrVen+KYD0kQmz5qWCuY5zJwc0/GPz0UtTqlXC8Ws5cGqm/Co6HXhPkv1OSmMbRz kOAq4nGsMDzus/q+GYS7LbG76VznHN1wo3Q1Ra3PGll/7/gUOu8YtJ4dbAE2/Nsx0oRO Rotg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bk2qBoea; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f2si1304302plj.147.2021.04.21.18.17.27; Wed, 21 Apr 2021 18:17:38 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bk2qBoea; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241688AbhDUSbK (ORCPT + 99 others); Wed, 21 Apr 2021 14:31:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:47327 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235723AbhDUSbI (ORCPT ); Wed, 21 Apr 2021 14:31:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619029835; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VtGtYNFtNAebLz2pgKqQah+fAXQ7o/bJBdongF2UrwY=; b=bk2qBoeaLwpD2LwmtpWUperRm+9c1Cunam97fB1lt8xVJLL0KZceqNBlWkzqWD+2M9wMc6 YeNf+GWrdN+z7XIY2qtNHkYzlpVzyt1OpKzWPdOcylF8uFm5HnQH0VMVplTUBMOsGcsYih LmQhwpTVk9+DHFUtV4sGMraXrh1iqNc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-360-r_aH-naCNO2wyBNc55BI9Q-1; Wed, 21 Apr 2021 14:30:13 -0400 X-MC-Unique: r_aH-naCNO2wyBNc55BI9Q-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B2FCB8542F4; Wed, 21 Apr 2021 18:29:59 +0000 (UTC) Received: from krava (unknown [10.40.195.227]) by smtp.corp.redhat.com (Postfix) with SMTP id AD5C05C1B4; Wed, 21 Apr 2021 18:29:57 +0000 (UTC) Date: Wed, 21 Apr 2021 20:29:56 +0200 From: Jiri Olsa To: Jin Yao 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 Subject: Re: [PATCH v4 15/25] perf stat: Filter out unmatched aggregation for hybrid event Message-ID: References: <20210416140517.18206-1-yao.jin@linux.intel.com> <20210416140517.18206-16-yao.jin@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210416140517.18206-16-yao.jin@linux.intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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