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

Commit 0bbd177f authored by Matt Buckley's avatar Matt Buckley
Browse files

Allow ADPF WorkDuration CPU duration to be zero

This patch updates the checks, tests, and documentation to ensure ADPF
CPU == 0 is allowed, and instead checks to make sure that both CPU
and GPU cannot be 0 at the same time.

Bug: 323226967
Test: atest PerformanceHintManagerTest
Change-Id: I6927899793c7d9801541465280af32627e200dc9
parent b2e2eefa
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -233,11 +233,11 @@ int APerformanceHint_setPreferPowerEfficiency(
 * @param workDuration The {@link AWorkDuration} structure of times the thread group took to
 *     complete its last task in nanoseconds breaking down into different components.
 *
 *     The work period start timestamp, actual total duration and actual CPU duration must be
 *     positive.
 *     The work period start timestamp and actual total duration must be greater than zero.
 *
 *     The actual GPU duration must be non-negative. If the actual GPU duration is 0, it means
 *     the actual GPU duration is not measured.
 *     The actual CPU and GPU durations must be greater than or equal to zero, and at least one
 *     of them must be greater than zero. When one of them is equal to zero, it means that type
 *     of work was not measured for this workload.
 *
 * @return 0 on success.
 *         EINVAL if any duration is an invalid number.
@@ -289,7 +289,8 @@ void AWorkDuration_setActualTotalDurationNanos(AWorkDuration* _Nonnull aWorkDura
 *
 * @param aWorkDuration The {@link AWorkDuration} created by calling {@link AWorkDuration_create()}
 * @param actualCpuDurationNanos The actual CPU work duration in nanoseconds. This number must be
 *        greater than zero.
 *        greater than or equal to zero. If it is equal to zero, that means the CPU was not
 *        measured.
 */
void AWorkDuration_setActualCpuDurationNanos(AWorkDuration* _Nonnull aWorkDuration,
        int64_t actualCpuDurationNanos) __INTRODUCED_IN(__ANDROID_API_V__);
@@ -299,7 +300,7 @@ void AWorkDuration_setActualCpuDurationNanos(AWorkDuration* _Nonnull aWorkDurati
 *
 * @param aWorkDuration The {@link AWorkDuration} created by calling {@link AWorkDuration_create()}.
 * @param actualGpuDurationNanos The actual GPU work duration in nanoseconds, the number must be
 *        non-negative. If the actual GPU duration is 0, it means the actual GPU duration is
 *        greater than or equal to zero. If it is equal to zero, that means the GPU was not
 *        measured.
 */
void AWorkDuration_setActualGpuDurationNanos(AWorkDuration* _Nonnull aWorkDuration,