Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp740710lqb; Wed, 17 Apr 2024 09:21:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVMf/I3EXbcHNPJPxGstpLXZzARYt4wsZB0KmkVmoniK19BBGLCYvC0r1OZMiOP72pLAPO4QsjyV2Oc9p1m4Z76tYtUjPRJlhuWH4m2FA== X-Google-Smtp-Source: AGHT+IHqwtwN8zL6X0jXEliG6tTearpUkfhd7ljtGF52yBxZSXgqV9/NfVJZC7vk4A5vx81FnUEH X-Received: by 2002:a05:6a00:2407:b0:6ea:c3bc:2031 with SMTP id z7-20020a056a00240700b006eac3bc2031mr19469pfh.7.1713370905855; Wed, 17 Apr 2024 09:21:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713370905; cv=pass; d=google.com; s=arc-20160816; b=vdgEFHLFjF6EWHY+MEUNZWcJn1IrvTjvQydOeFNH5dIjT9ZtAZbC4Ek2iywbZ/KULM TRuYMNkDP+oI7ahfyryIATByRFkCW/8361Rx+9DZpeIO1PGL0SdvLbo0MYqSjxuukSjr xlphhnstmI8ihph3+luYAAdcEIc7XwjSX51nXyhT+VXQ0uQfZFIaZAn7vhjZB5PN7djF 2ZrC+tR7z5rWKj0nSWflNoYLNd/r6h3fq866A6Q+LMbvhXzsd2iGLlMY7VFGWBkGb/mn ZCnu17aDxFbfY8IJF456MbPXlEEiavxlxer3O5GSg0y5v+0xjB2ew6RUJ5SV8vGrXpDP FwnA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ikyR5UTpdcgEEw8zssH0BHM+QdkRS6/QCbT1qHLw1sw=; fh=1PjBHhgVy251B0i3eQeRh85RQ9EH5DoFVfvjKSlNwIQ=; b=cVq0Tj5bxVwASHf6ORv9nQ5je47sc2lwdlZWFAEd2KLZyYcZhTRcHff6WcJQKlgxNN Q7OT8oUn6SilXTFMMuaPHyZ8OESCJfLkqOfRhXkKQO1lhChESpXUnNS27dQA6Uy2f+I2 7Ar+ZQj/C+oRsb6VfUXSv0uc280z59vs0953EaXCcvYiEw/cXo7cBrI4tuzisei9SN5U gSbpH84EQFamf6xUWYugSzXvG0mEdKHwMAmKwWMX2JSqwmnye1fXzA4KVLQK3EHovw0X 7cqSy5j/G2nbvQ6e31ta28Hs2B74ArBaCCUy4qLvj1WZbHEPwrUfekzemGR+ihplSTY7 gvcg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QnYqRRpU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-148898-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148898-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k11-20020aa79d0b000000b006e6b7198a73si11517704pfp.273.2024.04.17.09.21.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 09:21:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-148898-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QnYqRRpU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-148898-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148898-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1854F2822C6 for ; Wed, 17 Apr 2024 16:21:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8B522148842; Wed, 17 Apr 2024 16:21:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QnYqRRpU" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A42D084E14; Wed, 17 Apr 2024 16:21:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713370895; cv=none; b=X4hbGu7/K+FfhcqN/P3reNAzM7yXfElVkUnJmb0zPEa2/aHNkv6Q0p2gL6y1oEMFB2MmKNgSceYDdEttiFQ7GZYNwKL/DmsMWU4Z9pbe8oRSuuDkeroOgVxq9Ix+29eoaPwAfSV6VH/X7ipCtUxnsw9ttYb4n9Jk/r/2RAav+FA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713370895; c=relaxed/simple; bh=J3FQVL9iRcFEAIRpNm/D0Zmcow0IikX+upco464NSvk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RKlLUAzzPoDuylgi81eUJkAXh3fPkciehqjP06MSPiMH3P0POJ9TjyC9uQ4+9QfeeS8f4h8nrzRmzLuby0sFcPF0jBIVZuHLdCmQXPhRjUxZQ3rj7dO0zI9ayEWVy67atUdiwVV7vgVfsahOvHNWm8yh+cpYD+8wi7aqXmQR+GU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QnYqRRpU; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99A72C2BD11; Wed, 17 Apr 2024 16:21:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713370895; bh=J3FQVL9iRcFEAIRpNm/D0Zmcow0IikX+upco464NSvk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QnYqRRpUic+FDelR4GktLivA+b2yziRIAN2h2lw7leM6sB1YUFVG72LGEu2c25hCP 5h+cUHg+WzEWyX6qXkv/yTrEWmZmZ3TpEm+hxvkiIcAhFqSP9hIOl39DQpda5HKDd6 /C2hYWNANCQlsxuM7BljkzDDWsZIj1CJZOMUwcfOSyQgeEfN9eL4IQNQHUqyibiUis FxZHNEa6/Wr2iArt7ZUzEv5aW+fficEYRzWAJkkUWmFJUK6Layj1nB4qyAaK5ohi9A 5rAMq+K2mRxMXtLqcoG0sui26o5eO9zR/bc2sp1CIWMFThaPncO/I8fTWsSE+qnFTt GPzuIHv8wdsew== Date: Wed, 17 Apr 2024 13:21:31 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: weilin.wang@intel.com, Kan Liang , Namhyung Kim , Peter Zijlstra , Ingo Molnar , Alexander Shishkin , Jiri Olsa , Adrian Hunter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Perry Taylor , Samantha Alt , Caleb Biggers Subject: Re: [RFC PATCH v5 01/16] perf stat: Add new field in stat_config to enable hardware aware grouping. Message-ID: References: <20240412210756.309828-1-weilin.wang@intel.com> <20240412210756.309828-2-weilin.wang@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue, Apr 16, 2024 at 08:49:21PM -0700, Ian Rogers wrote: > On Fri, Apr 12, 2024 at 2:08 PM wrote: > > > > From: Weilin Wang > > > > Hardware counter and event information could be used to help creating event > > groups that better utilize hardware counters and improve multiplexing. > > > > Reviewed-by: Ian Rogers > > Signed-off-by: Weilin Wang > > --- > > tools/perf/builtin-stat.c | 5 +++++ > > tools/perf/util/metricgroup.c | 5 +++++ > > tools/perf/util/metricgroup.h | 1 + > > tools/perf/util/stat.h | 1 + > > 4 files changed, 12 insertions(+) > > > > diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c > > index 6bba1a89d030..c4a5f0984295 100644 > > --- a/tools/perf/builtin-stat.c > > +++ b/tools/perf/builtin-stat.c > > @@ -2106,6 +2106,7 @@ static int add_default_attributes(void) > > stat_config.metric_no_threshold, > > stat_config.user_requested_cpu_list, > > stat_config.system_wide, > > + stat_config.hardware_aware_grouping, > > &stat_config.metric_events); > > } > > > > @@ -2139,6 +2140,7 @@ static int add_default_attributes(void) > > stat_config.metric_no_threshold, > > stat_config.user_requested_cpu_list, > > stat_config.system_wide, > > + stat_config.hardware_aware_grouping, > > &stat_config.metric_events); > > } > > > > @@ -2173,6 +2175,7 @@ static int add_default_attributes(void) > > /*metric_no_threshold=*/true, > > stat_config.user_requested_cpu_list, > > stat_config.system_wide, > > + stat_config.hardware_aware_grouping, > > &stat_config.metric_events) < 0) > > return -1; > > } > > @@ -2214,6 +2217,7 @@ static int add_default_attributes(void) > > /*metric_no_threshold=*/true, > > stat_config.user_requested_cpu_list, > > stat_config.system_wide, > > + stat_config.hardware_aware_grouping, > > &stat_config.metric_events) < 0) > > return -1; > > > > @@ -2748,6 +2752,7 @@ int cmd_stat(int argc, const char **argv) > > stat_config.metric_no_threshold, > > stat_config.user_requested_cpu_list, > > stat_config.system_wide, > > + stat_config.hardware_aware_grouping, > > &stat_config.metric_events); > > > > zfree(&metrics); > > diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c > > index 79ef6095ab28..11613450725a 100644 > > --- a/tools/perf/util/metricgroup.c > > +++ b/tools/perf/util/metricgroup.c > > @@ -1690,12 +1690,17 @@ int metricgroup__parse_groups(struct evlist *perf_evlist, > > bool metric_no_threshold, > > const char *user_requested_cpu_list, > > bool system_wide, > > + bool hardware_aware_grouping, > > struct rblist *metric_events) > > { > > const struct pmu_metrics_table *table = pmu_metrics_table__find(); > > > > if (!table) > > return -EINVAL; > > + if (hardware_aware_grouping) { > > + pr_debug("Use hardware aware grouping instead of traditional metric grouping method\n"); > > + } > > nit: single line if statements shouldn't have curlies: > https://www.kernel.org/doc/html/v6.8/process/coding-style.html#placing-braces-and-spaces Fixed this while applying this patch. - Arnaldo