Increase poll max size, avoid performance issue when batching
Vts polls sensor events with max size of 1, which can cause
performance issue when batching. Increase it to 64 to help eliminate
potential performance issue.
Note this CL has no change in behavior of test.
Test: VTS target test pass on several devices
Bug: 62027156
Change-Id: I04a6791f407ec0a54eb6cd8df4d4ef41e8a89c12
Merged-In: I04a6791f407ec0a54eb6cd8df4d4ef41e8a89c12
(cherry picked from commit e337dfe3d250dabcbdc9d4c8e9620f76b96b4562)
diff --git a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
index f757a64..06a9d7e 100644
--- a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
+++ b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
@@ -200,19 +200,18 @@
bool needExit = *stop;
while(!needExit) {
- env->sensors->poll(1,
- [&](auto result, const auto &events, const auto &dynamicSensorsAdded) {
+ env->sensors->poll(64, [&](auto result, const auto& events, const auto& dynamicSensorsAdded) {
if (result != Result::OK
|| (events.size() == 0 && dynamicSensorsAdded.size() == 0)
|| *stop) {
- needExit = true;
- return;
+ needExit = true;
+ return;
}
- if (events.size() > 0) {
- env->addEvent(events[0]);
+ for (const auto& e : events) {
+ env->addEvent(e);
}
- });
+ });
}
ALOGD("polling thread end");
}