1 /* 2 * Copyright 2023 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 <ostream> 20 21 #include "AdpfTypes.h" 22 #include "AppDescriptorTrace.h" 23 #include "SessionRecords.h" 24 #include "UClampVoter.h" 25 26 namespace aidl { 27 namespace google { 28 namespace hardware { 29 namespace power { 30 namespace impl { 31 namespace pixel { 32 33 // Record the heuristic boost mode distribution among the frames 34 struct HeurBoostStatistics { 35 int64_t lightModeFrames{0}; 36 int64_t moderateModeFrames{0}; 37 int64_t severeModeFrames{0}; 38 }; 39 40 // Per-power-session values (equivalent to original PowerHintSession) 41 // Responsible for maintaining the state of the power session via attributes 42 // Primarily this means actual uclamp value and whether session is active 43 // (i.e. whether to include this power session uclmap when setting task uclamp) 44 struct SessionValueEntry { 45 int64_t sessionId{0}; 46 // Thread group id 47 int64_t tgid{0}; 48 uid_t uid{0}; 49 std::string idString; 50 bool isActive{true}; 51 bool isAppSession{false}; 52 android::hardware::power::SessionTag tag; 53 ProcessTag procTag; 54 std::chrono::steady_clock::time_point lastUpdatedTime; 55 std::shared_ptr<Votes> votes; 56 std::shared_ptr<AppDescriptorTrace> sessionTrace; 57 FrameBuckets sessFrameBuckets; 58 bool isPowerEfficient{false}; 59 HeurBoostStatistics hBoostModeDist; 60 bool rampupBoostActive{false}; 61 62 // Write info about power session to ostream for logging and debugging 63 std::ostream &dump(std::ostream &os) const; 64 }; 65 66 } // namespace pixel 67 } // namespace impl 68 } // namespace power 69 } // namespace hardware 70 } // namespace google 71 } // namespace aidl 72