From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ian Rogers <irogers@google.com>,
adrian.hunter@intel.com, james.clark@linaro.org,
jolsa@kernel.org, linux-kernel@vger.kernel.org,
linux-perf-users@vger.kernel.org, mingo@redhat.com,
peterz@infradead.org, skanev@google.com
Subject: Re: [PATCH v3 2/2] perf test: Add stat metrics --for-each-cgroup test
Date: Mon, 25 May 2026 16:49:59 -0300 [thread overview]
Message-ID: <ahSn58YTobyDYr_4@x1> (raw)
In-Reply-To: <agyZZdFQqedToej1@google.com>
On Tue, May 19, 2026 at 10:09:57AM -0700, Namhyung Kim wrote:
> On Tue, May 19, 2026 at 08:13:02AM -0700, Ian Rogers wrote:
> > On Mon, May 18, 2026 at 10:54 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > On Mon, May 18, 2026 at 10:01:50PM -0700, Ian Rogers wrote:
> > > > + # Parse each metric line
> > > > + while read -r line; do
> > > > + [ -z "${line}" ] && continue
> > > > +
> > > > + local cycles_val
> > > > + cycles_val=$(echo "${line}" | cut -d, -f1)
> > > > +
> > > > + local event_name
> > > > + event_name=$(echo "${line}" | cut -d, -f3)
> > > > +
> > > > + # Find corresponding instructions event line
> > > > + local inst_event_name
> > > > + inst_event_name="${event_name/cpu-cycles/instructions}"
> > > > + inst_event_name="${inst_event_name/cycles/instructions}"
> > > > +
> > > > + local inst_line
> > > > + inst_line=$(echo "${output}" | \
> > > > + grep -F ",${cgrp}," | \
> > > > + grep -F "${inst_event_name}" || true)
> > > > +
> > > > + local inst_val
> > > > + inst_val=$(echo "${inst_line}" | cut -d, -f1)
> > > > +
> > > > + log_verbose "Cgroup '${cgrp}': event '${event_name}' \
> > > > +val '${cycles_val}', inst event '${inst_event_name}' val '${inst_val}'"
> > > Why not make log_verbose() take multiple arguments and align them
> > > properly? Maybe you can just use 'echo'? The same goes to the below
> > > lines.
> > This fixes checkpatch warnings on line length and the odd alignment
> > avoids spaces appearing in the output.
> How about this?
Ian posted a v4, are you ok with that now, Tested-by or Reviewed-by?
- Arnaldo
> Thanks,
> Namhyung
>
>
> diff --git a/tools/perf/tests/shell/stat_metrics_cgrp.sh b/tools/perf/tests/shell/stat_metrics_cgrp.sh
> index d4226ee0ae9801cb..ecb2c053ea5158d4 100755
> --- a/tools/perf/tests/shell/stat_metrics_cgrp.sh
> +++ b/tools/perf/tests/shell/stat_metrics_cgrp.sh
> @@ -7,7 +7,7 @@ set -e
> test_cgroups=
>
> log_verbose() {
> - echo "$1"
> + echo "$*"
> }
>
> is_numeric_and_non_zero() {
> @@ -145,22 +145,22 @@ check_metric_reported()
> cycles_val=$(echo "${cycles_line}" | cut -d, -f1)
> fi
>
> - log_verbose "Cgroup '${cgrp}': event '${event_name}' \
> -val '${cycles_val}', inst val '${inst_val}'"
> + log_verbose "Cgroup '${cgrp}': event '${event_name}'" \
> + "val '${cycles_val}', inst val '${inst_val}'"
>
> # Only enforce metric check if both cycles and
> # instructions have non-zero numeric counts
> if is_numeric_and_non_zero "${cycles_val}" && \
> is_numeric_and_non_zero "${inst_val}"
> then
> - log_verbose "Enforcing metric check for cgroup '${cgrp}' \
> -event '${event_name}'"
> + log_verbose "Enforcing metric check for cgroup '${cgrp}'" \
> + "event '${event_name}'"
> # Check for nan or nested in the metric value (7th field)
> # Actually we can just check the whole line for simplicity
> if echo "${line}" | grep -q -i -E ",nan,|,nested,"
> then
> - echo "FAIL: Invalid metric value (nan/nested) \
> -for cgroup '${cgrp}'"
> + echo "FAIL: Invalid metric value (nan/nested)" \
> + "for cgroup '${cgrp}'"
> echo "Line: ${line}"
> exit 1
> fi
> @@ -173,8 +173,8 @@ for cgroup '${cgrp}'"
> exit 1
> fi
> else
> - log_verbose "Skipping metric check for cgroup '${cgrp}' \
> -event '${event_name}' (idle or not counted)"
> + log_verbose "Skipping metric check for cgroup '${cgrp}'" \
> + "event '${event_name}' (idle or not counted)"
> fi
> done <<< "${cgrp_lines}"
> done
next prev parent reply other threads:[~2026-05-25 19:50 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 22:22 [PATCH v1 0/2] Fix cgroup metric association with BPF counters Ian Rogers
2026-05-18 22:22 ` [PATCH v1 1/2] perf stat: Propagate supported flag to follower cgroup BPF events Ian Rogers
2026-05-18 22:22 ` [PATCH v1 2/2] perf test: Add stat metrics --for-each-cgroup test Ian Rogers
2026-05-19 1:51 ` [PATCH v2 0/2] Fix cgroup metric association with BPF counters Ian Rogers
2026-05-19 1:51 ` [PATCH v2 1/2] perf stat: Propagate supported flag to follower cgroup BPF events Ian Rogers
2026-05-19 1:51 ` [PATCH v2 2/2] perf test: Add stat metrics --for-each-cgroup test Ian Rogers
2026-05-19 5:01 ` [PATCH v3 0/2] Fix cgroup metric association with BPF counters Ian Rogers
2026-05-19 5:01 ` [PATCH v3 1/2] perf stat: Propagate supported flag to follower cgroup BPF events Ian Rogers
2026-05-19 5:47 ` Namhyung Kim
2026-05-19 5:01 ` [PATCH v3 2/2] perf test: Add stat metrics --for-each-cgroup test Ian Rogers
2026-05-19 5:54 ` Namhyung Kim
2026-05-19 15:13 ` Ian Rogers
2026-05-19 17:09 ` Namhyung Kim
2026-05-25 19:49 ` Arnaldo Carvalho de Melo [this message]
2026-05-25 22:46 ` Ian Rogers
2026-05-19 15:27 ` [PATCH v4 0/2] Fix cgroup metric association with BPF counters Ian Rogers
2026-05-19 15:27 ` [PATCH v4 1/2] perf stat: Propagate supported flag to follower cgroup BPF events Ian Rogers
2026-05-19 15:27 ` [PATCH v4 2/2] perf test: Add stat metrics --for-each-cgroup test Ian Rogers
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=ahSn58YTobyDYr_4@x1 \
--to=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=skanev@google.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox