Finish work on collecting execution duration. Add tests and execution state enforcement.

Fix bug: Execution durations reported by HAL were not
reported properly through NDK.

Ensure execution duration is reported as UINT64_MAX on error paths.

Switch SampleDriver from system_clock to steady_clock.

Clarify, enforce, and validate that several ANeuralNetworksExecution_*
methods must not be called once execution has been scheduled.

Enforce and validate that ANeuralNetworksExecution_setMeasureTiming
can only be called in conjunction with
ANeuralNetworksCompilation_createForDevices with numDevices = 1.

Enforce and validate that ANeuralNetworksExecution_getDuration must
not be called until execution has finished.

Test: NeuralNetworksTest_static
Test: --gtest_filter=IntrospectionControlTest.SimpleAddModel with
      setprop debug.nn.vlog driver,execution; by inspection of logcat,
      verify that driver and runtime report the same duration

Bug: 123376542
Bug: 79265318
Merged-In: I8a091f3f8207669114c10e89f3ed6a08ea241fbb
Change-Id: I8a091f3f8207669114c10e89f3ed6a08ea241fbb
(cherry picked from commit 07c3f7520b9062ae68a55372cdefc67c0792c4a0)
12 files changed
tree: 14f9d41d627b75a78c5d2e00527019b8e0a26ec1
  1. nn/
  2. .clang-format
  3. CleanSpec.mk
  4. OWNERS
  5. PREUPLOAD.cfg