1 /* 2 * Copyright 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #include <aidl/android/hardware/power/BnPowerHintSession.h> 20 #include <aidl/android/hardware/power/SessionTag.h> 21 22 #include <chrono> 23 24 #include "AdpfTypes.h" 25 26 namespace aidl::google::hardware::power::impl::pixel { 27 28 // The App Hint Descriptor struct manages information necessary 29 // to calculate the next uclamp min value from the PID function 30 // and is separate so that it can be used as a pointer for 31 // easily passing to the pid function 32 struct AppHintDesc { AppHintDescAppHintDesc33 AppHintDesc(int64_t sessionId, int32_t tgid, int32_t uid, const std::vector<int32_t> &threadIds, 34 android::hardware::power::SessionTag tag, ProcessTag procTag, 35 std::chrono::nanoseconds pTargetNs) 36 : sessionId(sessionId), 37 tgid(tgid), 38 uid(uid), 39 targetNs(pTargetNs), 40 thread_ids(threadIds), 41 tag(tag), 42 procTag(procTag), 43 pidControlVariable(0), 44 is_active(true), 45 update_count(0), 46 integral_error(0), 47 previous_error(0) {} 48 49 std::string toString() const; 50 int64_t sessionId{0}; 51 const int32_t tgid; 52 const int32_t uid; 53 std::chrono::nanoseconds targetNs; 54 std::vector<int32_t> thread_ids; 55 android::hardware::power::SessionTag tag; 56 ProcessTag procTag; 57 int pidControlVariable; 58 // status 59 std::atomic<bool> is_active; 60 // pid 61 uint64_t update_count = 0; 62 int64_t integral_error = 0; 63 int64_t previous_error = 0; 64 }; 65 66 } // namespace aidl::google::hardware::power::impl::pixel 67