* [PATCH V2] perf test: Basic branch counter support
@ 2023-11-07 18:40 kan.liang
2023-11-13 16:11 ` Liang, Kan
0 siblings, 1 reply; 4+ messages in thread
From: kan.liang @ 2023-11-07 18:40 UTC (permalink / raw)
To: acme, irogers, linux-kernel, linux-perf-users
Cc: peterz, mingo, jolsa, namhyung, adrian.hunter, tinghao.zhang,
Kan Liang
From: Kan Liang <kan.liang@linux.intel.com>
Add a basic test for the branch counter feature.
The test verifies that
- The new filter can be successfully applied on the supported platforms.
- The counter value can be outputted via the perf report -D
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
---
Changes since V2:
- Update the output msg for the skipped case (Ian)
tools/perf/tests/shell/record.sh | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh
index 4fbc74805d52..cc207a16ae24 100755
--- a/tools/perf/tests/shell/record.sh
+++ b/tools/perf/tests/shell/record.sh
@@ -11,6 +11,9 @@ err=0
perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
testprog="perf test -w thloop"
testsym="test_loop"
+cpu_pmu_dir="/sys/bus/event_source/devices/cpu*"
+br_cntr_file="/caps/branch_counter_nr"
+br_cntr_output="branch stack counters"
cleanup() {
rm -rf "${perfdata}"
@@ -154,10 +157,37 @@ test_workload() {
echo "Basic target workload test [Success]"
}
+test_branch_counter() {
+ echo "Basic branch counter test"
+ # Check if the branch counter feature is supported
+ for dir in $cpu_pmu_dir
+ do
+ if [ ! -e "$dir$br_cntr_file" ]
+ then
+ echo "branch counter feature not supported on all core PMUs ($dir) [Skipped]"
+ return
+ fi
+ done
+ if ! perf record -o "${perfdata}" -j any,counter ${testprog} 2> /dev/null
+ then
+ echo "Basic branch counter test [Failed record]"
+ err=1
+ return
+ fi
+ if ! perf report -i "${perfdata}" -D -q | grep -q "$br_cntr_output"
+ then
+ echo "Basic branch record test [Failed missing output]"
+ err=1
+ return
+ fi
+ echo "Basic branch counter test [Success]"
+}
+
test_per_thread
test_register_capture
test_system_wide
test_workload
+test_branch_counter
cleanup
exit $err
--
2.35.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH V2] perf test: Basic branch counter support
2023-11-07 18:40 [PATCH V2] perf test: Basic branch counter support kan.liang
@ 2023-11-13 16:11 ` Liang, Kan
2023-11-21 0:22 ` Ian Rogers
0 siblings, 1 reply; 4+ messages in thread
From: Liang, Kan @ 2023-11-13 16:11 UTC (permalink / raw)
To: acme, irogers, linux-kernel, linux-perf-users
Cc: peterz, mingo, jolsa, namhyung, adrian.hunter, tinghao.zhang
Hi Ian,
On 2023-11-07 1:40 p.m., kan.liang@linux.intel.com wrote:
> From: Kan Liang <kan.liang@linux.intel.com>
>
> Add a basic test for the branch counter feature.
>
> The test verifies that
> - The new filter can be successfully applied on the supported platforms.
> - The counter value can be outputted via the perf report -D
>
> Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
> ---
>
> Changes since V2:
> - Update the output msg for the skipped case (Ian)
>
Any comments for this patch?
Thanks,
Kan
> tools/perf/tests/shell/record.sh | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh
> index 4fbc74805d52..cc207a16ae24 100755
> --- a/tools/perf/tests/shell/record.sh
> +++ b/tools/perf/tests/shell/record.sh
> @@ -11,6 +11,9 @@ err=0
> perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
> testprog="perf test -w thloop"
> testsym="test_loop"
> +cpu_pmu_dir="/sys/bus/event_source/devices/cpu*"
> +br_cntr_file="/caps/branch_counter_nr"
> +br_cntr_output="branch stack counters"
>
> cleanup() {
> rm -rf "${perfdata}"
> @@ -154,10 +157,37 @@ test_workload() {
> echo "Basic target workload test [Success]"
> }
>
> +test_branch_counter() {
> + echo "Basic branch counter test"
> + # Check if the branch counter feature is supported
> + for dir in $cpu_pmu_dir
> + do
> + if [ ! -e "$dir$br_cntr_file" ]
> + then
> + echo "branch counter feature not supported on all core PMUs ($dir) [Skipped]"
> + return
> + fi
> + done
> + if ! perf record -o "${perfdata}" -j any,counter ${testprog} 2> /dev/null
> + then
> + echo "Basic branch counter test [Failed record]"
> + err=1
> + return
> + fi
> + if ! perf report -i "${perfdata}" -D -q | grep -q "$br_cntr_output"
> + then
> + echo "Basic branch record test [Failed missing output]"
> + err=1
> + return
> + fi
> + echo "Basic branch counter test [Success]"
> +}
> +
> test_per_thread
> test_register_capture
> test_system_wide
> test_workload
> +test_branch_counter
>
> cleanup
> exit $err
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH V2] perf test: Basic branch counter support
2023-11-13 16:11 ` Liang, Kan
@ 2023-11-21 0:22 ` Ian Rogers
2023-11-22 11:56 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 4+ messages in thread
From: Ian Rogers @ 2023-11-21 0:22 UTC (permalink / raw)
To: Liang, Kan
Cc: acme, linux-kernel, linux-perf-users, peterz, mingo, jolsa,
namhyung, adrian.hunter, tinghao.zhang
On Mon, Nov 13, 2023 at 8:12 AM Liang, Kan <kan.liang@linux.intel.com> wrote:
>
> Hi Ian,
>
> On 2023-11-07 1:40 p.m., kan.liang@linux.intel.com wrote:
> > From: Kan Liang <kan.liang@linux.intel.com>
> >
> > Add a basic test for the branch counter feature.
> >
> > The test verifies that
> > - The new filter can be successfully applied on the supported platforms.
> > - The counter value can be outputted via the perf report -D
> >
> > Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
> > ---
> >
> > Changes since V2:
> > - Update the output msg for the skipped case (Ian)
> >
>
> Any comments for this patch?
Confirmed the wildcard works as expected.
Tested-by: Ian Rogers <irogers@google.com>
Thanks,
Ian
> Thanks,
> Kan
>
> > tools/perf/tests/shell/record.sh | 30 ++++++++++++++++++++++++++++++
> > 1 file changed, 30 insertions(+)
> >
> > diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh
> > index 4fbc74805d52..cc207a16ae24 100755
> > --- a/tools/perf/tests/shell/record.sh
> > +++ b/tools/perf/tests/shell/record.sh
> > @@ -11,6 +11,9 @@ err=0
> > perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
> > testprog="perf test -w thloop"
> > testsym="test_loop"
> > +cpu_pmu_dir="/sys/bus/event_source/devices/cpu*"
> > +br_cntr_file="/caps/branch_counter_nr"
> > +br_cntr_output="branch stack counters"
> >
> > cleanup() {
> > rm -rf "${perfdata}"
> > @@ -154,10 +157,37 @@ test_workload() {
> > echo "Basic target workload test [Success]"
> > }
> >
> > +test_branch_counter() {
> > + echo "Basic branch counter test"
> > + # Check if the branch counter feature is supported
> > + for dir in $cpu_pmu_dir
> > + do
> > + if [ ! -e "$dir$br_cntr_file" ]
> > + then
> > + echo "branch counter feature not supported on all core PMUs ($dir) [Skipped]"
> > + return
> > + fi
> > + done
> > + if ! perf record -o "${perfdata}" -j any,counter ${testprog} 2> /dev/null
> > + then
> > + echo "Basic branch counter test [Failed record]"
> > + err=1
> > + return
> > + fi
> > + if ! perf report -i "${perfdata}" -D -q | grep -q "$br_cntr_output"
> > + then
> > + echo "Basic branch record test [Failed missing output]"
> > + err=1
> > + return
> > + fi
> > + echo "Basic branch counter test [Success]"
> > +}
> > +
> > test_per_thread
> > test_register_capture
> > test_system_wide
> > test_workload
> > +test_branch_counter
> >
> > cleanup
> > exit $err
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH V2] perf test: Basic branch counter support
2023-11-21 0:22 ` Ian Rogers
@ 2023-11-22 11:56 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2023-11-22 11:56 UTC (permalink / raw)
To: Ian Rogers
Cc: Liang, Kan, linux-kernel, linux-perf-users, peterz, mingo, jolsa,
namhyung, adrian.hunter, tinghao.zhang
Em Mon, Nov 20, 2023 at 04:22:24PM -0800, Ian Rogers escreveu:
> On Mon, Nov 13, 2023 at 8:12 AM Liang, Kan <kan.liang@linux.intel.com> wrote:
> > On 2023-11-07 1:40 p.m., kan.liang@linux.intel.com wrote:
> > > From: Kan Liang <kan.liang@linux.intel.com>
> > > Add a basic test for the branch counter feature.
> > > The test verifies that
> > > - The new filter can be successfully applied on the supported platforms.
> > > - The counter value can be outputted via the perf report -D
> > > Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
> > Any comments for this patch?
> Confirmed the wildcard works as expected.
> Tested-by: Ian Rogers <irogers@google.com>
Thanks, applied to perf-tools-next.
- Arnaldo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-11-22 11:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-07 18:40 [PATCH V2] perf test: Basic branch counter support kan.liang
2023-11-13 16:11 ` Liang, Kan
2023-11-21 0:22 ` Ian Rogers
2023-11-22 11:56 ` Arnaldo Carvalho de Melo
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.