From 3f576cd1fdfedd990dc41e96ed364c1152ea01e2 Mon Sep 17 00:00:00 2001 From: Peng Xu Date: Thu, 4 May 2017 16:36:37 -0700 Subject: [PATCH] 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) --- .../vts/functional/VtsHalSensorsV1_0TargetTest.cpp | 13 ++++++------- 1 file 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 f757a64bb3..06a9d7e829 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"); }