summaryrefslogtreecommitdiffstats
path: root/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
diff options
context:
space:
mode:
authorPeng Xu <pengxu@google.com>2017-05-04 16:36:37 -0700
committerPeng Xu <pengxu@google.com>2017-05-04 17:07:34 -0700
commite337dfe3d250dabcbdc9d4c8e9620f76b96b4562 (patch)
tree74962e5242e2b42a01b7d29ff691d2e7a2cc3a31 /sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
parent2499a69dfdb2a85ac82554f3e73d731fd8c656b3 (diff)
downloadandroid_hardware_interfaces-e337dfe3d250dabcbdc9d4c8e9620f76b96b4562.tar.gz
android_hardware_interfaces-e337dfe3d250dabcbdc9d4c8e9620f76b96b4562.tar.bz2
android_hardware_interfaces-e337dfe3d250dabcbdc9d4c8e9620f76b96b4562.zip
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 Change-Id: I04a6791f407ec0a54eb6cd8df4d4ef41e8a89c12
Diffstat (limited to 'sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp')
-rw-r--r--sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
index f757a64bb..06a9d7e82 100644
--- a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
+++ b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
@@ -200,19 +200,18 @@ void SensorsHidlEnvironment::pollingThread(
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");
}