[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fV+-ytA2st17Ar-jQ5xYqrWtxnF2TcADKrC5WoPyKz4wQ@mail.gmail.com>
Date: Wed, 5 Jun 2024 10:21:10 -0700
From: Ian Rogers <irogers@...gle.com>
To: kan.liang@...ux.intel.com
Cc: acme@...nel.org, namhyung@...nel.org, jolsa@...nel.org,
adrian.hunter@...el.com, linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org, "Khalil, Amiri" <amiri.khalil@...el.com>,
stable@...r.kernel.org
Subject: Re: [PATCH] perf stat: Fix the hard-coded metrics calculation on the hybrid
On Wed, Jun 5, 2024 at 9:10 AM <kan.liang@...ux.intel.com> wrote:
>
> From: Kan Liang <kan.liang@...ux.intel.com>
>
> The hard-coded metrics is wrongly calculated on the hybrid machine.
>
> $ perf stat -e cycles,instructions -a sleep 1
>
> Performance counter stats for 'system wide':
>
> 18,205,487 cpu_atom/cycles/
> 9,733,603 cpu_core/cycles/
> 9,423,111 cpu_atom/instructions/ # 0.52 insn per cycle
> 4,268,965 cpu_core/instructions/ # 0.23 insn per cycle
>
> The insn per cycle for cpu_core should be 4,268,965 / 9,733,603 = 0.44.
>
> When finding the metric events, the find_stat() doesn't take the PMU
> type into account. The cpu_atom/cycles/ is wrongly used to calculate
> the IPC of the cpu_core.
>
> Fixes: 0a57b910807a ("perf stat: Use counts rather than saved_value")
> Reported-by: "Khalil, Amiri" <amiri.khalil@...el.com>
> Signed-off-by: Kan Liang <kan.liang@...ux.intel.com>
Reviewed-by: Ian Rogers <irogers@...gle.com>
Thanks,
Ian
> Cc: stable@...r.kernel.org
> ---
> tools/perf/util/stat-shadow.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
> index 3466aa952442..4d0edc061f1a 100644
> --- a/tools/perf/util/stat-shadow.c
> +++ b/tools/perf/util/stat-shadow.c
> @@ -176,6 +176,10 @@ static double find_stat(const struct evsel *evsel, int aggr_idx, enum stat_type
> if (type != evsel__stat_type(cur))
> continue;
>
> + /* Ignore if not the PMU we're looking for. */
> + if (evsel->pmu != cur->pmu)
> + continue;
> +
> aggr = &cur->stats->aggr[aggr_idx];
> if (type == STAT_NSECS)
> return aggr->counts.val;
> --
> 2.35.1
>
Powered by blists - more mailing lists