• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2022 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 <string>
20 
21 namespace android {
22 namespace perfmgr {
23 
24 struct AdpfConfig {
25     std::string mName;
26     // Pid control
27     bool mPidOn;
28     double mPidPo;
29     double mPidPu;
30     double mPidI;
31     int64_t mPidIInit;
32     int64_t mPidIHigh;
33     int64_t mPidILow;
34     double mPidDo;
35     double mPidDu;
36     // Uclamp boost control
37     bool mUclampMinOn;
38     uint32_t mUclampMinInit;
39     uint32_t mUclampMinHigh;
40     uint32_t mUclampMinLow;
41     // Batch update control
42     uint64_t mSamplingWindowP;
43     uint64_t mSamplingWindowI;
44     uint64_t mSamplingWindowD;
45     int64_t mReportingRateLimitNs;
46     int64_t mFreezeDurationNs;
47     bool mEarlyBoostOn;
48     double mEarlyBoostTimeFactor;
49     double mTargetTimeFactor;
50     // Stale control
51     double mStaleTimeFactor;
52 
53     int64_t getPidIInitDivI();
54     int64_t getPidIHighDivI();
55     int64_t getPidILowDivI();
56     void dumpToFd(int fd);
57 
AdpfConfigAdpfConfig58     AdpfConfig(std::string name, bool pidOn, double pidPo, double pidPu, double pidI,
59                int64_t pidIInit, int64_t pidIHigh, int64_t pidILow, double pidDo, double pidDu,
60                bool uclampMinOn, uint32_t uclampMinInit, uint32_t uclampMinHigh,
61                uint32_t uclampMinLow, uint64_t samplingWindowP, uint64_t samplingWindowI,
62                uint64_t samplingWindowD, int64_t reportingRateLimitNs, bool earlyBoostOn,
63                double earlyBoostTimeFactor, double targetTimeFactor, double staleTimeFactor)
64         : mName(std::move(name)),
65           mPidOn(pidOn),
66           mPidPo(pidPo),
67           mPidPu(pidPu),
68           mPidI(pidI),
69           mPidIInit(pidIInit),
70           mPidIHigh(pidIHigh),
71           mPidILow(pidILow),
72           mPidDo(pidDo),
73           mPidDu(pidDu),
74           mUclampMinOn(uclampMinOn),
75           mUclampMinInit(uclampMinInit),
76           mUclampMinHigh(uclampMinHigh),
77           mUclampMinLow(uclampMinLow),
78           mSamplingWindowP(samplingWindowP),
79           mSamplingWindowI(samplingWindowI),
80           mSamplingWindowD(samplingWindowD),
81           mReportingRateLimitNs(reportingRateLimitNs),
82           mEarlyBoostOn(earlyBoostOn),
83           mEarlyBoostTimeFactor(earlyBoostTimeFactor),
84           mTargetTimeFactor(targetTimeFactor),
85           mStaleTimeFactor(staleTimeFactor) {}
86 };
87 
88 }  // namespace perfmgr
89 }  // namespace android
90