linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf arm-spe: Test memory samples
@ 2022-04-13  1:02 Leo Yan
  2022-04-13 17:17 ` German Gomez
  0 siblings, 1 reply; 3+ messages in thread
From: Leo Yan @ 2022-04-13  1:02 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	James Clark, German Gomez, linux-perf-users, linux-kernel
  Cc: Leo Yan

Add a new test to verify the Arm SPE synthesized memory samples with
'perf mem report' command.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 tools/perf/tests/shell/test_arm_spe.sh | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/shell/test_arm_spe.sh b/tools/perf/tests/shell/test_arm_spe.sh
index e59044edc406..b36125e127eb 100755
--- a/tools/perf/tests/shell/test_arm_spe.sh
+++ b/tools/perf/tests/shell/test_arm_spe.sh
@@ -62,6 +62,18 @@ perf_report_samples() {
 		egrep " +[0-9]+\.[0-9]+% +[0-9]+\.[0-9]+% +$1 " > /dev/null 2>&1
 }
 
+perf_mem_report_samples() {
+	echo "Looking at perf.data file for reporting memory samples:"
+
+	# Below is an example of the memory samples reporting:
+	#   20.71%    1696    27    L1 hit     [k] el0t_64_sync_handler    [kernel.kallsyms]    ...
+	#   17.21%    1903    20    L1 hit     [k] el0t_64_sync            [kernel.kallsyms]    ...
+	#    8.52%     897    21    L1 hit     [k] ksys_read               [kernel.kallsyms]    ...
+	#    0.12%      16    17    L1 hit     [.] 0x0000000000004ce8      dd                   ...
+	perf mem report --stdio -i ${perfdata} 2>&1 | \
+		egrep " +[0-9]+\.[0-9]+% +[0-9]+ +[0-9]+ .* +$1 " > /dev/null 2>&1
+}
+
 arm_spe_snapshot_test() {
 	echo "Recording trace with snapshot mode $perfdata"
 	perf record -o ${perfdata} -e arm_spe// -S \
@@ -79,7 +91,8 @@ arm_spe_snapshot_test() {
 	wait $PERFPID
 
 	perf_script_samples dd &&
-	perf_report_samples dd
+	perf_report_samples dd &&
+	perf_mem_report_samples dd
 
 	err=$?
 	arm_spe_report "SPE snapshot testing" $err
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf arm-spe: Test memory samples
  2022-04-13  1:02 [PATCH] perf arm-spe: Test memory samples Leo Yan
@ 2022-04-13 17:17 ` German Gomez
  2022-04-14  2:37   ` Leo Yan
  0 siblings, 1 reply; 3+ messages in thread
From: German Gomez @ 2022-04-13 17:17 UTC (permalink / raw)
  To: Leo Yan, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	James Clark, linux-perf-users, linux-kernel


On 13/04/2022 02:02, Leo Yan wrote:
> Add a new test to verify the Arm SPE synthesized memory samples with
> 'perf mem report' command.
>
> Signed-off-by: Leo Yan <leo.yan@linaro.org>

Reviewed-by: German Gomez <german.gomez@arm.com>

Thanks for the patch.

There are some tests for perf_event_attr fields. We added one for SPE
recently [1], but it's not checking the sample_type attribute yet.

We could update it from our side and send another patch, to test the
DATA_SRC bit is not missing.

[1] https://lore.kernel.org/all/20220126160710.32983-1-german.gomez@arm.com/

Thanks,
German

> ---
>  tools/perf/tests/shell/test_arm_spe.sh | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/tests/shell/test_arm_spe.sh b/tools/perf/tests/shell/test_arm_spe.sh
> index e59044edc406..b36125e127eb 100755
> --- a/tools/perf/tests/shell/test_arm_spe.sh
> +++ b/tools/perf/tests/shell/test_arm_spe.sh
> @@ -62,6 +62,18 @@ perf_report_samples() {
>  		egrep " +[0-9]+\.[0-9]+% +[0-9]+\.[0-9]+% +$1 " > /dev/null 2>&1
>  }
>  
> +perf_mem_report_samples() {
> +	echo "Looking at perf.data file for reporting memory samples:"
> +
> +	# Below is an example of the memory samples reporting:
> +	#   20.71%    1696    27    L1 hit     [k] el0t_64_sync_handler    [kernel.kallsyms]    ...
> +	#   17.21%    1903    20    L1 hit     [k] el0t_64_sync            [kernel.kallsyms]    ...
> +	#    8.52%     897    21    L1 hit     [k] ksys_read               [kernel.kallsyms]    ...
> +	#    0.12%      16    17    L1 hit     [.] 0x0000000000004ce8      dd                   ...
> +	perf mem report --stdio -i ${perfdata} 2>&1 | \
> +		egrep " +[0-9]+\.[0-9]+% +[0-9]+ +[0-9]+ .* +$1 " > /dev/null 2>&1
> +}
> +
>  arm_spe_snapshot_test() {
>  	echo "Recording trace with snapshot mode $perfdata"
>  	perf record -o ${perfdata} -e arm_spe// -S \
> @@ -79,7 +91,8 @@ arm_spe_snapshot_test() {
>  	wait $PERFPID
>  
>  	perf_script_samples dd &&
> -	perf_report_samples dd
> +	perf_report_samples dd &&
> +	perf_mem_report_samples dd
>  
>  	err=$?
>  	arm_spe_report "SPE snapshot testing" $err

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf arm-spe: Test memory samples
  2022-04-13 17:17 ` German Gomez
@ 2022-04-14  2:37   ` Leo Yan
  0 siblings, 0 replies; 3+ messages in thread
From: Leo Yan @ 2022-04-14  2:37 UTC (permalink / raw)
  To: German Gomez
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	James Clark, linux-perf-users, linux-kernel

On Wed, Apr 13, 2022 at 06:17:18PM +0100, German Gomez wrote:
> 
> On 13/04/2022 02:02, Leo Yan wrote:
> > Add a new test to verify the Arm SPE synthesized memory samples with
> > 'perf mem report' command.
> >
> > Signed-off-by: Leo Yan <leo.yan@linaro.org>
> 
> Reviewed-by: German Gomez <german.gomez@arm.com>

Thanks for reviewing.

> Thanks for the patch.
> 
> There are some tests for perf_event_attr fields. We added one for SPE
> recently [1], but it's not checking the sample_type attribute yet.
> 
> We could update it from our side and send another patch, to test the
> DATA_SRC bit is not missing.

Agreed, it's better to update the patch for checking DATA_SRC bit and
resend it.  Thanks!

Leo

> [1] https://lore.kernel.org/all/20220126160710.32983-1-german.gomez@arm.com/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-14  2:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-13  1:02 [PATCH] perf arm-spe: Test memory samples Leo Yan
2022-04-13 17:17 ` German Gomez
2022-04-14  2:37   ` Leo Yan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).