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