All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Clark <james.clark@linaro.org>
To: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Kan Liang <kan.liang@linux.intel.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] perf stat: Don't print uncounted hwmon events
Date: Fri, 28 Mar 2025 10:55:38 +0000	[thread overview]
Message-ID: <6ebf4627-913a-409c-98b2-7dbc120107fa@linaro.org> (raw)
In-Reply-To: <20250328045337.229354-1-irogers@google.com>



On 28/03/2025 4:53 am, Ian Rogers wrote:
> Aggregation is different for core events compared to uncore. For
> uncore we don't want the counts for events not in the aggregation
> id. Switch the !counter->pmu->is_uncore test to a
> counter->pmu->is_core as the hwmon PMU doesn't set the uncore
> boolean. There are 2 booleans as some PMUs forget to set either
> cpumask or cpus that are used to determine whether a PMU is uncore or
> core. Also check config->aggr_get_id is present as the non-core
> 'software' PMU doesn't have it set.
> 
> Before:
> ```
> $ perf stat --per-core -e temp_cpu -a true
> 
>   Performance counter stats for 'system wide':
> 
> S0-D0-C0              1              63.00 'C   temp_cpu
> S0-D0-C1              0      <not counted> 'C   temp_cpu
> S0-D0-C2              0      <not counted> 'C   temp_cpu
> S0-D0-C3              0      <not counted> 'C   temp_cpu
> S0-D0-C4              0      <not counted> 'C   temp_cpu
> S0-D0-C5              0      <not counted> 'C   temp_cpu
> S0-D0-C6              0      <not counted> 'C   temp_cpu
> S0-D0-C7              0      <not counted> 'C   temp_cpu
> 
>         0.001375790 seconds time elapsed
> ```
> 
> After:
> ```
> $ perf stat --per-core -e temp_cpu -a true
> 
>   Performance counter stats for 'system wide':
> 
> S0-D0-C0              1              38.00 'C   temp_cpu
> 
>         0.001260575 seconds time elapsed
> ```
> 
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>   tools/perf/util/stat-display.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
> index 91386429115d..ed3270ab2557 100644
> --- a/tools/perf/util/stat-display.c
> +++ b/tools/perf/util/stat-display.c
> @@ -981,7 +981,7 @@ static bool should_skip_zero_counter(struct perf_stat_config *config,
>   	 * Skip value 0 when it's an uncore event and the given aggr id
>   	 * does not belong to the PMU cpumask.
>   	 */
> -	if (!counter->pmu || !counter->pmu->is_uncore)
> +	if (!counter->pmu || counter->pmu->is_core || !config->aggr_get_id)
>   		return false;
>   
>   	perf_cpu_map__for_each_cpu(cpu, idx, counter->pmu->cpus) {

Reviewed-by: James Clark <james.clark@linaro.org>


      reply	other threads:[~2025-03-28 10:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-28  4:53 [PATCH v1] perf stat: Don't print uncounted hwmon events Ian Rogers
2025-03-28 10:55 ` James Clark [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6ebf4627-913a-409c-98b2-7dbc120107fa@linaro.org \
    --to=james.clark@linaro.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.