tests/benchmarks: Consolidate the benchmark confs
The benchmark conf at the moment is the same for all benchmarks. There's no
point in duplicating them. Provide a default conf and if the individual
benchmark needs to provide something else to override it, then can either be
provided by overriding bm_conf or by setting properties in the object. This
brings down total LOC too.
Signed-off-by: Joel Fernandes <joelaf@google.com>
diff --git a/libs/utils/android/benchmark.py b/libs/utils/android/benchmark.py
index 5b81ccf..12fcb41 100644
--- a/libs/utils/android/benchmark.py
+++ b/libs/utils/android/benchmark.py
@@ -47,7 +47,48 @@
directory.
"""
- bm_conf = None
+ bm_conf = {
+
+ # Target platform and board
+ "platform" : 'android',
+
+ # Define devlib modules to load
+ "modules" : [
+ 'cpufreq',
+ ],
+
+ # FTrace events to collect for all the tests configuration which have
+ # the "ftrace" flag enabled
+ "ftrace" : {
+ "events" : [
+ "sched_switch",
+ "sched_overutilized",
+ "sched_contrib_scale_f",
+ "sched_load_avg_cpu",
+ "sched_load_avg_task",
+ "sched_tune_tasks_update",
+ "sched_boost_cpu",
+ "sched_boost_task",
+ "sched_energy_diff",
+ "cpu_frequency",
+ "cpu_idle",
+ "cpu_capacity",
+ ],
+ "buffsize" : 10 * 1024,
+ },
+
+ # Default EnergyMeter Configuration
+ "emeter" : {
+ "instrument" : "acme",
+ "channel_map" : {
+ "Device0" : 0,
+ }
+ },
+
+ # Tools required by the experiments
+ "tools" : [ 'trace-cmd' ],
+
+ }
"""Override this with a dictionary or JSON path to configure the TestEnv"""
bm_name = None
@@ -145,10 +186,6 @@
def _getBmConf(self):
- if self.bm_conf is None:
- msg = 'Benchmark subclasses must override the `bm_conf` attribute'
- raise NotImplementedError(msg)
-
# Override default configuration with command line parameters
if self.args.boot_image:
self.bm_reboot = True
diff --git a/tests/benchmarks/android_geekbench.py b/tests/benchmarks/android_geekbench.py
index d8b1af3..1e80b59 100755
--- a/tests/benchmarks/android_geekbench.py
+++ b/tests/benchmarks/android_geekbench.py
@@ -11,52 +11,6 @@
class GeekbenchTest(LisaBenchmark):
- bm_conf = {
-
- # Target platform and board
- "platform" : 'android',
-
- # Define devlib modules to load
- "modules" : [
- 'cpufreq',
- ],
-
- # FTrace events to collect for all the tests configuration which have
- # the "ftrace" flag enabled
- "ftrace" : {
- "events" : [
- "sched_switch",
- "sched_overutilized",
- "sched_contrib_scale_f",
- "sched_load_avg_cpu",
- "sched_load_avg_task",
- "sched_tune_tasks_update",
- "sched_boost_cpu",
- "sched_boost_task",
- "sched_energy_diff",
- "cpu_frequency",
- "cpu_idle",
- "cpu_capacity",
- ],
- "buffsize" : 10 * 1024,
- },
-
- # Default EnergyMeter Configuration
- "emeter" : {
- "instrument" : "acme",
- "channel_map" : {
- "Device0" : 0,
- }
- },
-
- # Tools required by the experiments
- "tools" : [ 'trace-cmd' ],
-
- # Default results folder
- "results_dir" : "AndroidGeekbench",
-
- }
-
# Android Workload to run
bm_name = 'Geekbench'
diff --git a/tests/benchmarks/android_gmaps.py b/tests/benchmarks/android_gmaps.py
index fc2b929..d198790 100755
--- a/tests/benchmarks/android_gmaps.py
+++ b/tests/benchmarks/android_gmaps.py
@@ -11,52 +11,6 @@
class GMapsTest(LisaBenchmark):
- bm_conf = {
-
- # Target platform and board
- "platform" : 'android',
-
- # Define devlib modules to load
- "modules" : [
- 'cpufreq',
- ],
-
- # FTrace events to collect for all the tests configuration which have
- # the "ftrace" flag enabled
- "ftrace" : {
- "events" : [
- "sched_switch",
- "sched_overutilized",
- "sched_contrib_scale_f",
- "sched_load_avg_cpu",
- "sched_load_avg_task",
- "sched_tune_tasks_update",
- "sched_boost_cpu",
- "sched_boost_task",
- "sched_energy_diff",
- "cpu_frequency",
- "cpu_idle",
- "cpu_capacity",
- ],
- "buffsize" : 10 * 1024,
- },
-
- # Default EnergyMeter Configuration
- "emeter" : {
- "instrument" : "acme",
- "channel_map" : {
- "Device0" : 0,
- }
- },
-
- # Tools required by the experiments
- "tools" : [ 'trace-cmd' ],
-
- # Default results folder
- "results_dir" : "AndroidGMaps",
-
- }
-
# Android Workload to run
bm_name = 'GMaps'
diff --git a/tests/benchmarks/android_jankbench.py b/tests/benchmarks/android_jankbench.py
index 883cc3f..ee35ffc 100755
--- a/tests/benchmarks/android_jankbench.py
+++ b/tests/benchmarks/android_jankbench.py
@@ -12,52 +12,6 @@
class JankbenchTest(LisaBenchmark):
- bm_conf = {
-
- # Target platform and board
- "platform" : 'android',
-
- # Define devlib modules to load
- "modules" : [
- 'cpufreq',
- ],
-
- # FTrace events to collect for all the tests configuration which have
- # the "ftrace" flag enabled
- "ftrace" : {
- "events" : [
- "sched_switch",
- "sched_overutilized",
- "sched_contrib_scale_f",
- "sched_load_avg_cpu",
- "sched_load_avg_task",
- "sched_tune_tasks_update",
- "sched_boost_cpu",
- "sched_boost_task",
- "sched_energy_diff",
- "cpu_frequency",
- "cpu_idle",
- "cpu_capacity",
- ],
- "buffsize" : 10 * 1024,
- },
-
- # Default EnergyMeter Configuration
- "emeter" : {
- "instrument" : "acme",
- "channel_map" : {
- "Device0" : 0,
- }
- },
-
- # Tools required by the experiments
- "tools" : [ 'trace-cmd' ],
-
- # Default results folder
- "results_dir" : "AndroidJankbench",
-
- }
-
# Android Workload to run
bm_name = 'Jankbench'
diff --git a/tests/benchmarks/android_uibench.py b/tests/benchmarks/android_uibench.py
index 5058d16..40f8e26 100755
--- a/tests/benchmarks/android_uibench.py
+++ b/tests/benchmarks/android_uibench.py
@@ -11,52 +11,6 @@
class UiBenchTest(LisaBenchmark):
- bm_conf = {
-
- # Target platform and board
- "platform" : 'android',
-
- # Define devlib modules to load
- "modules" : [
- 'cpufreq',
- ],
-
- # FTrace events to collect for all the tests configuration which have
- # the "ftrace" flag enabled
- "ftrace" : {
- "events" : [
- "sched_switch",
- "sched_overutilized",
- "sched_contrib_scale_f",
- "sched_load_avg_cpu",
- "sched_load_avg_task",
- "sched_tune_tasks_update",
- "sched_boost_cpu",
- "sched_boost_task",
- "sched_energy_diff",
- "cpu_frequency",
- "cpu_idle",
- "cpu_capacity",
- ],
- "buffsize" : 10 * 1024,
- },
-
- # Default EnergyMeter Configuration
- "emeter" : {
- "instrument" : "acme",
- "channel_map" : {
- "Device0" : 0,
- }
- },
-
- # Tools required by the experiments
- "tools" : [ 'trace-cmd' ],
-
- # Default results folder
- "results_dir" : "AndroidUiBench",
-
- }
-
# Android Workload to run
bm_name = 'UiBench'
diff --git a/tests/benchmarks/android_vellamo.py b/tests/benchmarks/android_vellamo.py
index 6450931..a5b4e17 100755
--- a/tests/benchmarks/android_vellamo.py
+++ b/tests/benchmarks/android_vellamo.py
@@ -11,52 +11,6 @@
class VellamoTest(LisaBenchmark):
- bm_conf = {
-
- # Target platform and board
- "platform" : 'android',
-
- # Define devlib modules to load
- "modules" : [
- 'cpufreq',
- ],
-
- # FTrace events to collect for all the tests configuration which have
- # the "ftrace" flag enabled
- "ftrace" : {
- "events" : [
- "sched_switch",
- "sched_overutilized",
- "sched_contrib_scale_f",
- "sched_load_avg_cpu",
- "sched_load_avg_task",
- "sched_tune_tasks_update",
- "sched_boost_cpu",
- "sched_boost_task",
- "sched_energy_diff",
- "cpu_frequency",
- "cpu_idle",
- "cpu_capacity",
- ],
- "buffsize" : 10 * 1024,
- },
-
- # Default EnergyMeter Configuration
- "emeter" : {
- "instrument" : "acme",
- "channel_map" : {
- "Device0" : 0,
- }
- },
-
- # Tools required by the experiments
- "tools" : [ 'trace-cmd' ],
-
- # Default results folder
- "results_dir" : "AndroidVellamo",
-
- }
-
# Android Workload to run
bm_name = 'Vellamo'
diff --git a/tests/benchmarks/android_youtube.py b/tests/benchmarks/android_youtube.py
index 3822965..44f450d 100755
--- a/tests/benchmarks/android_youtube.py
+++ b/tests/benchmarks/android_youtube.py
@@ -11,52 +11,6 @@
class YouTubeTest(LisaBenchmark):
- bm_conf = {
-
- # Target platform and board
- "platform" : 'android',
-
- # Define devlib modules to load
- "modules" : [
- 'cpufreq',
- ],
-
- # FTrace events to collect for all the tests configuration which have
- # the "ftrace" flag enabled
- "ftrace" : {
- "events" : [
- "sched_switch",
- "sched_overutilized",
- "sched_contrib_scale_f",
- "sched_load_avg_cpu",
- "sched_load_avg_task",
- "sched_tune_tasks_update",
- "sched_boost_cpu",
- "sched_boost_task",
- "sched_energy_diff",
- "cpu_frequency",
- "cpu_idle",
- "cpu_capacity",
- ],
- "buffsize" : 10 * 1024,
- },
-
- # Default EnergyMeter Configuration
- "emeter" : {
- "instrument" : "acme",
- "channel_map" : {
- "Device0" : 0,
- }
- },
-
- # Tools required by the experiments
- "tools" : [ 'trace-cmd' ],
-
- # Default results folder
- "results_dir" : "AndroidYouTube",
-
- }
-
# Android Workload to run
bm_name = 'YouTube'