Skip to contentSkip to conversation

Add speedometer new test cases for amd-pstate-ut

PATCH New Meng Li 1 participant 3 messages Oct 25, 2022

Subsystems (3)
lore
Share & tools
lore

Meng Li

author
#0 lore raw

cover Add speedometer new test cases for amd-pstate-ut

Hi all:

The new patches are modified on the basis of the previous patch
https://lore.kernel.org/lkml/[email protected]/.

Add speedometer.sh trigger the speedometer testing and monitor the cpu information.

Modify rst document to introduce test steps and results etc.

Thanks,
Jasmine

Meng Li (2):
selftests: amd-pstate: Trigger speedometer benchmark and test cpus
Documentation: amd-pstate: Add speedometer test introduction

 Documentation/admin-guide/pm/amd-pstate.rst   |  75 +++-
 tools/testing/selftests/amd-pstate/Makefile   |   2 +-
 tools/testing/selftests/amd-pstate/run.sh     |  32 +-
 .../selftests/amd-pstate/selenium_server.sh   |  15 +
 .../selftests/amd-pstate/speedometer.sh       | 349 ++++++++++++++++++
 .../selftests/amd-pstate/speedometer_web.py   | 106 ++++++
 6 files changed, 571 insertions(+), 8 deletions(-)
 create mode 100755 tools/testing/selftests/amd-pstate/selenium_server.sh
 create mode 100755 tools/testing/selftests/amd-pstate/speedometer.sh
 create mode 100755 tools/testing/selftests/amd-pstate/speedometer_web.py
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 1/2 selftests: amd-pstate: Trigger speedometer benchmark and test cpus

Add speedometer.sh trigger the speedometer testing and monitor the cpu desire performance, frequency, load, power consumption and throughput etc.

---
 tools/testing/selftests/amd-pstate/Makefile   |   2 +-
 tools/testing/selftests/amd-pstate/run.sh     |  32 +-
 .../selftests/amd-pstate/selenium_server.sh   |  15 +
 .../selftests/amd-pstate/speedometer.sh       | 349 ++++++++++++++++++
 .../selftests/amd-pstate/speedometer_web.py   | 106 ++++++
 5 files changed, 497 insertions(+), 7 deletions(-)
 create mode 100755 tools/testing/selftests/amd-pstate/selenium_server.sh
 create mode 100755 tools/testing/selftests/amd-pstate/speedometer.sh
 create mode 100755 tools/testing/selftests/amd-pstate/speedometer_web.py
tools/testing/selftests/amd-pstate/Makefile +1 -1
index 5f195ee756d6..d6171775fb61 100644
@@ -13,6 +13,6 @@ TEST_GEN_FILES += ../../../power/x86/intel_pstate_tracer/intel_pstate_tracer.py
 endif
 
 TEST_PROGS := run.sh
-TEST_FILES := basic.sh tbench.sh gitsource.sh
+TEST_FILES := basic.sh tbench.sh gitsource.sh speedometer.sh speedometer_web.py selenium_server.sh
 
 include ../lib.mk
tools/testing/selftests/amd-pstate/run.sh +26 -6
index 9ef6eff347d3..a09e435df4a3 100755
@@ -11,6 +11,7 @@ fi
 source basic.sh
 source tbench.sh
 source gitsource.sh
+source speedometer.sh
 
 # amd-pstate-ut only run on x86/x86_64 AMD systems.
 ARCH=$(uname -m 2>/dev/null | sed -e 's/i.86/x86/' -e 's/x86_64/x86/')
@@ -20,6 +21,7 @@ FUNC=all
 OUTFILE=selftest
 OUTFILE_TBENCH="$OUTFILE.tbench"
 OUTFILE_GIT="$OUTFILE.gitsource"
+OUTFILE_SPEEDOMETER="$OUTFILE.speedometer"
 
 SYSFS=
 CPUROOT=
@@ -135,6 +137,9 @@ amd_pstate_all()
 
 	# gitsource
 	amd_pstate_gitsource
+
+	# speedometer
+	amd_pstate_speedometer
 }
 
 helpme()
@@ -145,10 +150,11 @@ helpme()
 	[-c <all: All testing,
 	     basic: Basic testing,
 	     tbench: Tbench testing,
-	     gitsource: Gitsource testing.>]
+	     gitsource: Gitsource testing,
+	     speedometer: Speedometer testing.>]
 	[-t <tbench time limit>]
 	[-p <tbench process number>]
-	[-l <loop times for tbench>]
+	[-l <loop times>]
 	[-i <amd tracer interval>]
 	[-m <comparative test: acpi-cpufreq>]
 	\n"
@@ -164,7 +170,7 @@ parse_arguments()
 				helpme
 				;;
 
-			c) # --func_type (Function to perform: basic, tbench, gitsource (default: all))
+			c) # --func_type (Function to perform: basic, tbench, gitsource, speedometer (default: all))
 				FUNC=$OPTARG
 				;;
 
@@ -180,7 +186,7 @@ parse_arguments()
 				PROCESS_NUM=$OPTARG
 				;;
 
-			l) # --tbench/gitsource-loop-times
+			l) # --tbench/gitsource/speedometer-loop-times
 				LOOP_TIMES=$OPTARG
 				;;
 
@@ -248,7 +254,7 @@ prerequisite()
 		fi
 	else
 		case "$FUNC" in
-			"tbench" | "gitsource")
+			"tbench" | "gitsource" | "speedometer")
 				if [ "$scaling_driver" != "$COMPARATIVE_TEST" ]; then
 					echo "$0 # Skipped: Comparison test can only run on $COMPARISON_TEST driver."
 					echo "$0 # Current cpufreq scaling drvier is $scaling_driver."
@@ -257,7 +263,7 @@ prerequisite()
 				;;
 
 			*)
-				echo "$0 # Skipped: Comparison test are only for tbench or gitsource."
+				echo "$0 # Skipped: Comparison test are only for tbench, gitsource or speedometer."
 				echo "$0 # Current comparative test is for $FUNC."
 				exit $ksft_skip
 				;;
@@ -284,6 +290,10 @@ prerequisite()
 		"gitsource")
 			command_perf
 			;;
+
+		"speedometer")
+			command_perf
+			;;
 	esac
 
 	SYSFS=`mount -t sysfs | head -1 | awk '{ print $3 }'`
@@ -335,6 +345,10 @@ do_test()
 			amd_pstate_gitsource
 			;;
 
+		"speedometer")
+			amd_pstate_speedometer
+			;;
+
 		*)
 			echo "Invalid [-f] function type"
 			helpme
@@ -364,6 +378,12 @@ pre_clear_dumps()
 			rm -rf gitsource_*.png
 			;;
 
+		"speedometer")
+			rm -rf $OUTFILE.log
+			rm -rf $OUTFILE.backup_governor.log
+			rm -rf speedometer_*.png
+			;;
+
 		*)
 			;;
 	esac
tools/testing/selftests/amd-pstate/selenium_server.sh new file +15 -0
new file mode 100755
index 000000000000..d2cb5aeaea3f
@@ -0,0 +1,15 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+# Before test speedometer benchmark, this script trigger selenium server.
+
+selenium_server_name="selenium-server.jar"
+selenium_server_url="https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.3.0/selenium-server-4.3.0.jar"
+
+if [ ! -f $selenium_server_name ]; then
+	printf "Download selenium server, please wait a moment ...\n\n"
+	wget -O $selenium_server_name $selenium_server_url
+fi
+
+printf "Run selenium server standalone ...\n\n"
+java -jar $selenium_server_name standalone --port 9515
tools/testing/selftests/amd-pstate/speedometer.sh new file +349 -0

349 lines not on this page · raw message

tools/testing/selftests/amd-pstate/speedometer_web.py new file +106 -0

106 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#2 lore raw

PATCH 2/2 Documentation: amd-pstate: Add speedometer test introduction

In reply to Meng Li

Introduce speedometer test cases design and implementation. Monitor cpus changes about performance and power consumption etc.

---
 Documentation/admin-guide/pm/amd-pstate.rst | 75 ++++++++++++++++++++-
 1 file changed, 74 insertions(+), 1 deletion(-)
Documentation/admin-guide/pm/amd-pstate.rst +74 -1
index 4f0d5169ff86..769982f66eca 100644
@@ -451,6 +451,23 @@ Unit Tests for amd-pstate
         The specified governor is ondemand or schedutil.
         Gitsource can also be tested on the ``acpi-cpufreq`` kernel driver for comparison.
 
+    4). Speedometer test
+
+        Test and monitor the cpu changes when running speedometer benchmark under the specified governor.
+        These changes include desire performance, frequency, load, time, energy etc.
+        The specified governor is ondemand or schedutil.
+        Speedometer can also be tested on the ``acpi-cpufreq`` kernel driver for comparison.
+
+#. Preparations before tests
+
+    1). Speedometer
+
+     + Python version 3.0.x or higher
+     + Install chromium-browser
+     + Install chromium-chromedriver
+     + Install selenium on the client
+     + Install selenium-server on the server
+
 #. How to execute the tests
 
    We use test module in the kselftest frameworks to implement it.
@@ -487,6 +504,8 @@ Unit Tests for amd-pstate
         $ sudo ./run.sh -t tbench -m acpi-cpufreq
         $ sudo ./run.sh -t gitsource
         $ sudo ./run.sh -t gitsource -m acpi-cpufreq
+        $ sudo ./run.sh -t speedometer
+        $ sudo ./run.sh -t speedometer -m acpi-cpufreq
         $ ./run.sh --help
         ./run.sh: illegal option -- -
         Usage: ./run.sh [OPTION...]
@@ -495,7 +514,8 @@ Unit Tests for amd-pstate
                 [-c <all: All testing,
                      basic: Basic testing,
                      tbench: Tbench testing,
-                     gitsource: Gitsource testing.>]
+                     gitsource: Gitsource testing,
+                     speedometer: Speedometer testing.>]
                 [-t <tbench time limit>]
                 [-p <tbench process number>]
                 [-l <loop times for tbench>]
@@ -621,6 +641,59 @@ Unit Tests for amd-pstate
          + acpi-cpufreq-schedutil VS amd-pstate-schedutil  | Comprison(%) |          |          |          | 2.1115      | 4.2873  | -4.1110              |
          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
 
+        + speedometer
+
+         When you finish test, you will get selftest.speedometer.csv and png images.
+         The selftest.speedometer.csv file contains the raw data and the drop of the comparative test.
+         The png images shows the goal, time, energy and performan per watt of each test.
+         Open selftest.speedometer.csv :
+
+         +-------------------------------------------------+--------------+----------+----------+----------+-------------+-------------+---------+----------------------+
+         + Governor                                        | Round        | Des-perf | Freq     | Load     | Goal        | Time        | Energy  | Performance Per Watt |
+         +-------------------------------------------------+--------------+----------+----------+----------+-------------+-------------+---------+----------------------+
+         + Unit                                            |              |          | GHz      |          | Runs/Minute | s           | J       | Runs/w               |
+         +=================================================+==============+==========+==========+==========+=============+=============+=========+======================+
+         + acpi-cpufreq-ondemand                           | 1            |          |          |          | 209         | 51          | 731.84  | 0.2427               |
+         +-------------------------------------------------+--------------+----------+----------+----------+-------------+-------------+---------+----------------------+
+         + acpi-cpufreq-ondemand                           | 2            |          |          |          | 205         | 51          | 759.03  | 0.2295               |
+         +-------------------------------------------------+--------------+----------+----------+----------+-------------+-------------+---------+----------------------+
+         + acpi-cpufreq-ondemand                           | 3            |          |          |          | 206         | 51          | 755.15  | 0.2318               |
+         +-------------------------------------------------+--------------+----------+----------+----------+-------------+-------------+---------+----------------------+
+         + acpi-cpufreq-ondemand                           | Average      |          |          |          | 206.667     | 51          | 748.673 | 0.2346               |
+         +-------------------------------------------------+--------------+----------+----------+----------+-------------+-------------+---------+----------------------+
+         + acpi-cpufreq-schedutil                          | 1            |          |          |          | 206         | 56          | 775.08  | 0.248                |
+         +-------------------------------------------------+--------------+----------+----------+----------+-------------+-------------+---------+----------------------+
+         + acpi-cpufreq-schedutil                          | 2            |          |          |          | 204         | 51          | 762.06  | 0.2275               |
+         +-------------------------------------------------+--------------+----------+----------+----------+-------------+-------------+---------+----------------------+
+         + acpi-cpufreq-schedutil                          | 3            |          |          |          | 207         | 56          | 776.35  | 0.2488               |
+         +-------------------------------------------------+--------------+----------+----------+----------+-------------+-------------+---------+----------------------+
+         + acpi-cpufreq-schedutil                          | Average      |          |          |          | 205.667     | 54.3333     | 771.163 | 0.2415               |
+         +-------------------------------------------------+--------------+----------+----------+----------+-------------+-------------+---------+----------------------+
+         + amd-pstate-ondemand                             | 1            | 24.7974  | 1.73142  | 7.71728  | 195         | 64          | 756.6   | 0.2749               |
+         +-------------------------------------------------+--------------+----------+----------+----------+-------------+-------------+---------+----------------------+
+         + amd-pstate-ondemand                             | 2            | 26.1653  | 1.91492  | 8.5525   | 195         | 51          | 705.67  | 0.2348               |
+         +-------------------------------------------------+--------------+----------+----------+----------+-------------+-------------+---------+----------------------+
+         + amd-pstate-ondemand                             | 3            | 24.1789  | 1.69516  | 7.41152  | 196         | 65          | 758.98  | 0.2797               |
+         +-------------------------------------------------+--------------+----------+----------+----------+-------------+-------------+---------+----------------------+
+         + amd-pstate-ondemand                             | Average      | 25.0472  | 1.7805   | 7.89377  | 195.333     | 60          | 740.417 | 0.2638               |
+         +-------------------------------------------------+--------------+----------+----------+----------+-------------+-------------+---------+----------------------+
+         + amd-pstate-schedutil                            | 1            | 67.0214  | 2.76691  | 17.1314  | 197         | 51          | 737.52  | 0.227                |
+         +-------------------------------------------------+--------------+----------+----------+----------+-------------+-------------+---------+----------------------+
+         + amd-pstate-schedutil                            | 2            | 64.3032  | 2.75981  | 16.1196  | 198         | 55          | 763.57  | 0.2376               |
+         +-------------------------------------------------+--------------+----------+----------+----------+-------------+-------------+---------+----------------------+
+         + amd-pstate-schedutil                            | 3            | 65.5175  | 2.59423  | 17.0067  | 201         | 51          | 735.96  | 0.2321               |
+         +-------------------------------------------------+--------------+----------+----------+----------+-------------+-------------+---------+----------------------+
+         + amd-pstate-schedutil                            | Average      | 65.614   | 2.70698  | 16.7526  | 198.667     | 52.3333     | 745.683 | 0.2323               |
+         +-------------------------------------------------+--------------+----------+----------+----------+-------------+-------------+---------+----------------------+
+         + acpi-cpufreq-ondemand VS acpi-cpufreq-schedutil | Comprison(%) |          |          |          | -0.4838     | 6.5358      | 3.0039  | 2.9411               |
+         +-------------------------------------------------+--------------+----------+----------+----------+-------------+-------------+---------+----------------------+
+         + amd-pstate-ondemand VS amd-pstate-schedutil     | Comprison(%) | 161.9614 | 52.0348  | 112.2255 | 1.7068      | -12.7778    | 0.7112  | -11.9408             |
+         +-------------------------------------------------+--------------+----------+----------+----------+-------------+-------------+---------+----------------------+
+         + acpi-cpufreq-ondemand VS amd-pstate-ondemand    | Comprison(%) |          |          |          | -5.4841     | 17.647      | -1.1027 | 12.4467              |
+         +-------------------------------------------------+--------------+----------+----------+----------+-------------+-------------+---------+----------------------+
+         + acpi-cpufreq-schedutil VS amd-pstate-schedutil  | Comprison(%) |          |          |          | -3.4035     | -3.6809     | -3.3041 | -3.8095              |
+         +-------------------------------------------------+--------------+----------+----------+----------+-------------+-------------+---------+----------------------+
+
 Reference
 ===========
 
Signature · 1 line
2.34.1