vibratorservice: Fix broken benchmarks
Fixes an issue with the benchmarks, where they would skip unsupported
situations by early returning without reaching the measure loop and
without notifying the framework.
The framework would then retry the exact same scenario indefinitely.
To fix, makes sure every early return also calls SkipWithMessage.
Fixes: 279134938
Test: adb shell /tmp/VibratorHalControllerBenchmarks --v=2
Change-Id: If7f92816133bf3d03a5915b6f077eb961d55cf75
diff --git a/services/vibratorservice/benchmarks/VibratorHalControllerBenchmarks.cpp b/services/vibratorservice/benchmarks/VibratorHalControllerBenchmarks.cpp
index 971a0b9..e11a809 100644
--- a/services/vibratorservice/benchmarks/VibratorHalControllerBenchmarks.cpp
+++ b/services/vibratorservice/benchmarks/VibratorHalControllerBenchmarks.cpp
@@ -152,6 +152,7 @@
BENCHMARK_WRAPPER(VibratorBench, setAmplitude, {
if (!hasCapabilities(vibrator::Capabilities::AMPLITUDE_CONTROL, state)) {
+ state.SkipWithMessage("missing capability");
return;
}
@@ -180,6 +181,7 @@
BENCHMARK_WRAPPER(VibratorBench, setAmplitudeCached, {
if (!hasCapabilities(vibrator::Capabilities::AMPLITUDE_CONTROL, state)) {
+ state.SkipWithMessage("missing capability");
return;
}
@@ -200,6 +202,7 @@
BENCHMARK_WRAPPER(VibratorBench, setExternalControl, {
if (!hasCapabilities(vibrator::Capabilities::EXTERNAL_CONTROL, state)) {
+ state.SkipWithMessage("missing capability");
return;
}
@@ -221,6 +224,7 @@
BENCHMARK_WRAPPER(VibratorBench, setExternalControlCached, {
if (!hasCapabilities(vibrator::Capabilities::EXTERNAL_CONTROL, state)) {
+ state.SkipWithMessage("missing capability");
return;
}
@@ -239,6 +243,7 @@
BENCHMARK_WRAPPER(VibratorBench, setExternalAmplitudeCached, {
if (!hasCapabilities(vibrator::Capabilities::EXTERNAL_AMPLITUDE_CONTROL, state)) {
+ state.SkipWithMessage("missing capability");
return;
}
@@ -331,9 +336,11 @@
BENCHMARK_WRAPPER(VibratorEffectsBench, alwaysOnEnable, {
if (!hasCapabilities(vibrator::Capabilities::ALWAYS_ON_CONTROL, state)) {
+ state.SkipWithMessage("missing capability");
return;
}
if (!hasArgs(state)) {
+ state.SkipWithMessage("missing args");
return;
}
@@ -357,9 +364,11 @@
BENCHMARK_WRAPPER(VibratorEffectsBench, alwaysOnDisable, {
if (!hasCapabilities(vibrator::Capabilities::ALWAYS_ON_CONTROL, state)) {
+ state.SkipWithMessage("missing capability");
return;
}
if (!hasArgs(state)) {
+ state.SkipWithMessage("missing args");
return;
}
@@ -384,6 +393,7 @@
BENCHMARK_WRAPPER(VibratorEffectsBench, performEffect, {
if (!hasArgs(state)) {
+ state.SkipWithMessage("missing args");
return;
}
@@ -441,9 +451,11 @@
BENCHMARK_WRAPPER(VibratorPrimitivesBench, performComposedEffect, {
if (!hasCapabilities(vibrator::Capabilities::COMPOSE_EFFECTS, state)) {
+ state.SkipWithMessage("missing capability");
return;
}
if (!hasArgs(state)) {
+ state.SkipWithMessage("missing args");
return;
}
@@ -468,4 +480,4 @@
}
});
-BENCHMARK_MAIN();
\ No newline at end of file
+BENCHMARK_MAIN();