Improve performance of Burst executions

Prior to this CL, the Burst object operated under one of two modes:
(1) "non-blocking" mode, where the Burst controller and server both
    constantly poll whether data is available in the FMQ. This approach
    is good because it results in very low IPC latency times, but has
    the potential to waste power because the CPU is constantly doing
    work.
(2) "blocking" mode, where the Burst controller and server both wait on
    a futex whenever they attempt to read data from the FMQ. This
    approach is good because it saves power (the thread is idle), but
    results in higher IPC latency times because the thread must be
    awoken before it can continue to retrieve the data.

This CL fuses the two approaches for better performance. Specifically,
the FMQ consumer will poll/spin for a period of time to see if the data
is available. If the data becomes available in this time, it
immediately retrieves it and continues processing. If the data does not
become available within this time, the consumer waits on the futex
until the data becomes available in order to save power.

This makes Burst operate with very low IPC latencies when the driver
service executes fully within the polling time window, and makes the
Burst operate with IPC latencies similar to the synchronous execution
path when the driver service has a longer run time.

In this CL, the default polling time is 0us for power saving execution
preference and 50us otherwise. The polling time is configurable with a
system property, and the time can be specified by running either:
  adb shell setprop debug.nn.burst-controller-polling-window <microseconds>
  adb shell setprop debug.nn.sample-driver-burst-polling-window <microseconds>

This change also adds includes that were missing indicated by the IWYU
repohook.

Bug: 132073143
Test: mma
Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksV1_*TargetTest
Test: inspected logcat and ensured that both spinning- and futex-based
    waiting schemes were used for both the ExecutionBurstController and
    ExecutionBurstServer

Change-Id: I120e0b24c7236105d75d93696dde8deddd0e3507
13 files changed
tree: a376e6421695d9e486236cb20644859a0560e10f
  1. nn/
  2. .clang-format
  3. CleanSpec.mk
  4. CPPLINT.cfg
  5. OWNERS
  6. PREUPLOAD.cfg