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