Skip to contentSkip to conversation

perf test: Add ARM SPE system wide test

PATCH Superseded Namhyung Kim 2 participants 3 messages Jun 15, 2022 – Jun 16, 2022 perf events

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Namhyung Kim

author maintainer
#0 lore raw

PATCH 1/1 perf test: Add ARM SPE system wide test

In the past it had a problem not setting the pid/tid on the sample correctly when system-wide mode is used. Although it's fixed now it'd be nice if we have a test case for it.

---
 tools/perf/tests/shell/test_arm_spe.sh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
tools/perf/tests/shell/test_arm_spe.sh +15 -0
index e59044edc406..b9c588ae393b 100755
@@ -23,6 +23,7 @@ glb_err=0
 cleanup_files()
 {
 	rm -f ${perfdata}
+	rm -f ${perfdata}.old
 	exit $glb_err
 }
 
@@ -85,5 +86,19 @@ arm_spe_snapshot_test() {
 	arm_spe_report "SPE snapshot testing" $err
 }
 
+arm_spe_system_wide_test() {
+	echo "Recording trace with system-wide mode $perfdata"
+	perf record -o ${perfdata} -e arm_spe// -a \
+		-- dd if=/dev/zero of=/dev/null count=100000 > /dev/null 2>&1
+
+	perf_script_samples dd &&
+	perf_report_samples dd
+
+	err=$?
+	arm_spe_report "SPE system-wide testing" $err
+}
+
 arm_spe_snapshot_test
+arm_spe_system_wide_test
+
 exit $glb_err
Signature · 1 line
2.36.1.476.g0c4daa206d-goog
#1 lore raw

Thanks for the patch, Namhyung

Quoted 24 lines · Namhyung Kim

In the past it had a problem not setting the pid/tid on the sample correctly when system-wide mode is used. Although it's fixed now it'd be nice if we have a test case for it.

---
 tools/perf/tests/shell/test_arm_spe.sh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
tools/perf/tests/shell/test_arm_spe.sh +1 -0
index e59044edc406..b9c588ae393b 100755
@@ -23,6 +23,7 @@ glb_err=0
 cleanup_files()
 {
 	rm -f ${perfdata}
+	rm -f ${perfdata}.old
 	exit $glb_err
 }
 

tools/perf/tests/shell/test_arm_spe.sh arm_spe_snapshot_test() { · line 93

Quoted 8 lines
tools/perf/tests/shell/test_arm_spe.sh +5 -0
@@ -85,5 +86,19 @@ arm_spe_snapshot_test() {
 	arm_spe_report "SPE snapshot testing" $err
 }
 
+arm_spe_system_wide_test() {
+	echo "Recording trace with system-wide mode $perfdata"
+	perf record -o ${perfdata} -e arm_spe// -a \
+		-- dd if=/dev/zero of=/dev/null count=100000 > /dev/null 2>&1
+

Should we skip if we don't have privileges for CPU tracing? (attached diff)

German

tools/perf/tests/shell/test_arm_spe.sh arm_spe_snapshot_test() { · line 104

Quoted 11 lines
tools/perf/tests/shell/test_arm_spe.sh +9 -0
+	perf_script_samples dd &&
+	perf_report_samples dd
+
+	err=$?
+	arm_spe_report "SPE system-wide testing" $err
+}
+
 arm_spe_snapshot_test
+arm_spe_system_wide_test
+
 exit $glb_err
tools/perf/tests/shell/test_arm_spe.sh +10 -3
index b9c588ae3..962841a51 100755
@@ -30,11 +30,13 @@ cleanup_files()
 trap cleanup_files exit term int
 
 arm_spe_report() {
-	if [ $2 != 0 ]; then
+	if [ $2 = 0 ]; then
+		echo "$1: PASS"
+	elif [ $2 = 2 ]; then
+		echo "$1: SKIPPED"
+	else
 		echo "$1: FAIL"
 		glb_err=$2
-	else
-		echo "$1: PASS"
 	fi
 }
 
@@ -91,6 +93,11 @@ arm_spe_system_wide_test() {
 	perf record -o ${perfdata} -e arm_spe// -a \
 		-- dd if=/dev/zero of=/dev/null count=100000 > /dev/null 2>&1
 
+	if [ $? != 0 ]; then
+		arm_spe_report "SPE system-wide testing" 2
+		return
+	fi
+
 	perf_script_samples dd &&
 	perf_report_samples dd
 
author maintainer
#2 lore raw

Hello,

Quoted 31 lines · German Gomez

Thanks for the patch, Namhyung

Quoted 27 lines · Namhyung Kim

In the past it had a problem not setting the pid/tid on the sample correctly when system-wide mode is used. Although it's fixed now it'd be nice if we have a test case for it.

---
 tools/perf/tests/shell/test_arm_spe.sh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
tools/perf/tests/shell/test_arm_spe.sh +1 -0
index e59044edc406..b9c588ae393b 100755
@@ -23,6 +23,7 @@ glb_err=0
 cleanup_files()
 {
      rm -f ${perfdata}
+     rm -f ${perfdata}.old
      exit $glb_err
 }
 
@@ -85,5 +86,19 @@ arm_spe_snapshot_test() {
      arm_spe_report "SPE snapshot testing" $err
 }
 
Quoted 7 lines

tools/perf/tests/shell/test_arm_spe.sh arm_spe_snapshot_test() { · line 93

Quoted 5 lines
tools/perf/tests/shell/test_arm_spe.sh +5 -0
+arm_spe_system_wide_test() {
+     echo "Recording trace with system-wide mode $perfdata"
+     perf record -o ${perfdata} -e arm_spe// -a \
+             -- dd if=/dev/zero of=/dev/null count=100000 > /dev/null 2>&1
+

Should we skip if we don't have privileges for CPU tracing? (attached diff)

Oh, you're right. I'll squash it to the patch.

Thanks,
Namhyung

Quoted 12 lines
Quoted 12 lines
tools/perf/tests/shell/test_arm_spe.sh +9 -0
+     perf_script_samples dd &&
+     perf_report_samples dd
+
+     err=$?
+     arm_spe_report "SPE system-wide testing" $err
+}
+
 arm_spe_snapshot_test
+arm_spe_system_wide_test
+
 exit $glb_err