Skip to content

Commit 6d5b9da

Browse files
Treehugger RobotAndroid (Google) Code Review
authored andcommitted
Merge "Ensure libpowermanager benchmarks always notify framework on return" into main
2 parents 2e07797 + eefb6a4 commit 6d5b9da

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

services/powermanager/benchmarks/PowerHalAidlBenchmarks.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,14 @@ static void runBenchmark(benchmark::State& state, microseconds delay, R (IPower:
7070

7171
if (hal == nullptr) {
7272
ALOGV("Power HAL not available, skipping test...");
73+
state.SkipWithMessage("Power HAL unavailable");
7374
return;
7475
}
7576

7677
ndk::ScopedAStatus ret = (*hal.*fn)(std::forward<Args1>(args1)...);
7778
if (ret.getExceptionCode() == binder::Status::EX_UNSUPPORTED_OPERATION) {
7879
ALOGV("Power HAL does not support this operation, skipping test...");
80+
state.SkipWithMessage("operation unsupported");
7981
return;
8082
}
8183

@@ -97,6 +99,7 @@ static void runSessionBenchmark(benchmark::State& state, R (IPowerHintSession::*
9799

98100
if (hal == nullptr) {
99101
ALOGV("Power HAL not available, skipping test...");
102+
state.SkipWithMessage("Power HAL unavailable");
100103
return;
101104
}
102105

@@ -109,12 +112,14 @@ static void runSessionBenchmark(benchmark::State& state, R (IPowerHintSession::*
109112

110113
if (session == nullptr) {
111114
ALOGV("Power HAL doesn't support session, skipping test...");
115+
state.SkipWithMessage("operation unsupported");
112116
return;
113117
}
114118

115119
ndk::ScopedAStatus ret = (*session.*fn)(std::forward<Args1>(args1)...);
116120
if (ret.getExceptionCode() == binder::Status::EX_UNSUPPORTED_OPERATION) {
117121
ALOGV("Power HAL does not support this operation, skipping test...");
122+
state.SkipWithMessage("operation unsupported");
118123
return;
119124
}
120125

@@ -163,13 +168,15 @@ static void BM_PowerHalAidlBenchmarks_createHintSession(benchmark::State& state)
163168

164169
if (hal == nullptr) {
165170
ALOGV("Power HAL not available, skipping test...");
171+
state.SkipWithMessage("Power HAL unavailable");
166172
return;
167173
}
168174

169175
ndk::ScopedAStatus ret =
170176
hal->createHintSession(tgid, uid, threadIds, durationNanos, &appSession);
171177
if (ret.getExceptionCode() == binder::Status::EX_UNSUPPORTED_OPERATION) {
172178
ALOGV("Power HAL does not support this operation, skipping test...");
179+
state.SkipWithMessage("operation unsupported");
173180
return;
174181
}
175182

services/powermanager/benchmarks/PowerHalHidlBenchmarks.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ static void runBenchmark(benchmark::State& state, microseconds delay, Return<R>
5050

5151
if (hal == nullptr) {
5252
ALOGV("Power HAL HIDL not available, skipping test...");
53+
state.SkipWithMessage("Power HAL unavailable");
5354
return;
5455
}
5556

0 commit comments

Comments
 (0)