Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3f576cd1 authored by Peng Xu's avatar Peng Xu
Browse files

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 e337dfe3)
parent c558ddf3
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -200,8 +200,7 @@ 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) {
@@ -209,8 +208,8 @@ void SensorsHidlEnvironment::pollingThread(
              return;
          }

          if (events.size() > 0) {
            env->addEvent(events[0]);
          for (const auto& e : events) {
              env->addEvent(e);
          }
      });
  }