summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJimmy Shiu <jimmyshiu@google.com>2021-09-08 16:37:34 +0800
committerJimmy Shiu <jimmyshiu@google.com>2021-09-30 00:36:29 +0000
commit5250c3aaf7265a31f4b638859db9c51a513a5d3c (patch)
tree7c8e4f92847c5f7eecc4d7b1cecb8cd061ab7198
parentde0dba53505e279e8468f610aa75cb9b629003ad (diff)
downloadpixel-5250c3aaf7265a31f4b638859db9c51a513a5d3c.tar.gz
ADPF: limit uclamp high/low values and use I as boost base
1. set uclamp.min high to 384 (from 512) 2. set uclamp.min low to 2 (from 0) 3. set kPo to 2 (from 5) 4. set kPu to 1 (from 3) 5. instead of the previous boost value, use I Error-Integral as the base of boost value. 6. add more traces (wakeup, overtime) Bug: 198708191 Bug: 197586898 Bug: 197540375 Test: build and check trace adb shell perfetto -o \ /data/misc/perfetto-traces/trace_file.perfetto-trace -t 20s sched \ freq idle am wm gfx view power hal Change-Id: I35484322a84c2ab19f3024cf6634c1818ba570b0
-rw-r--r--power-libperfmgr/aidl/PowerHintSession.cpp32
1 files changed, 23 insertions, 9 deletions
diff --git a/power-libperfmgr/aidl/PowerHintSession.cpp b/power-libperfmgr/aidl/PowerHintSession.cpp
index 7a39dab0..3db6ea15 100644
--- a/power-libperfmgr/aidl/PowerHintSession.cpp
+++ b/power-libperfmgr/aidl/PowerHintSession.cpp
@@ -95,8 +95,8 @@ static double getDoubleProperty(const char *prop, double value) {
return value;
}
-static double sPidPOver = getDoubleProperty(kPowerHalAdpfPidPOver, 5.0);
-static double sPidPUnder = getDoubleProperty(kPowerHalAdpfPidPUnder, 3.0);
+static double sPidPOver = getDoubleProperty(kPowerHalAdpfPidPOver, 2.0);
+static double sPidPUnder = getDoubleProperty(kPowerHalAdpfPidPUnder, 1.0);
static double sPidI = getDoubleProperty(kPowerHalAdpfPidI, 0.001);
static double sPidDOver = getDoubleProperty(kPowerHalAdpfPidDOver, 500.0);
static double sPidDUnder = getDoubleProperty(kPowerHalAdpfPidDUnder, 0.0);
@@ -113,12 +113,12 @@ static const int64_t sPidIHighLimit =
static const int64_t sPidILowLimit =
(sPidI == 0) ? 0
: static_cast<int64_t>(::android::base::GetIntProperty<int64_t>(
- kPowerHalAdpfPidILowLimit, -120) /
+ kPowerHalAdpfPidILowLimit, -30) /
sPidI);
static const int32_t sUclampMinHighLimit =
- ::android::base::GetUintProperty<uint32_t>(kPowerHalAdpfUclampMinHighLimit, 512);
+ ::android::base::GetUintProperty<uint32_t>(kPowerHalAdpfUclampMinHighLimit, 384);
static const int32_t sUclampMinLowLimit =
- ::android::base::GetUintProperty<uint32_t>(kPowerHalAdpfUclampMinLowLimit, 0);
+ ::android::base::GetUintProperty<uint32_t>(kPowerHalAdpfUclampMinLowLimit, 2);
static const uint32_t sUclampMinGranularity =
::android::base::GetUintProperty<uint32_t>(kPowerHalAdpfUclampMinGranularity, 5);
static const int64_t sStaleTimeFactor =
@@ -286,12 +286,13 @@ ndk::ScopedAStatus PowerHintSession::reportActualWorkDuration(
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
}
if (PowerHintMonitor::getInstance()->isRunning() && isStale()) {
+ mDescriptor->integral_error = std::max(sPidIInit, mDescriptor->integral_error);
if (ATRACE_ENABLED()) {
const std::string idstr = getIdString();
- std::string sz = StringPrintf("adpf.%s-stale", idstr.c_str());
+ std::string sz = StringPrintf("adpf.%s-wakeup", idstr.c_str());
+ ATRACE_INT(sz.c_str(), mDescriptor->integral_error);
ATRACE_INT(sz.c_str(), 0);
}
- mDescriptor->integral_error = std::max(sPidIInit, mDescriptor->integral_error);
}
int64_t targetDurationNanos = (int64_t)mDescriptor->duration.count();
int64_t length = actualDurations.size();
@@ -325,6 +326,15 @@ ndk::ScopedAStatus PowerHintSession::reportActualWorkDuration(
}
mDescriptor->previous_error = error;
}
+ if (ATRACE_ENABLED()) {
+ const std::string idstr = getIdString();
+ std::string sz = StringPrintf("adpf.%s-err", idstr.c_str());
+ ATRACE_INT(sz.c_str(), err_sum / (length - p_start));
+ sz = StringPrintf("adpf.%s-integral", idstr.c_str());
+ ATRACE_INT(sz.c_str(), mDescriptor->integral_error);
+ sz = StringPrintf("adpf.%s-derivative", idstr.c_str());
+ ATRACE_INT(sz.c_str(), derivative_sum / dt / (length - d_start));
+ }
int64_t pOut = static_cast<int64_t>((err_sum > 0 ? sPidPOver : sPidPUnder) * err_sum /
(length - p_start));
int64_t iOut = static_cast<int64_t>(sPidI * mDescriptor->integral_error);
@@ -332,6 +342,7 @@ ndk::ScopedAStatus PowerHintSession::reportActualWorkDuration(
derivative_sum / dt / (length - d_start));
int64_t output = pOut + iOut + dOut;
+
if (ATRACE_ENABLED()) {
const std::string idstr = getIdString();
std::string sz = StringPrintf("adpf.%s-actl_last", idstr.c_str());
@@ -350,6 +361,10 @@ ndk::ScopedAStatus PowerHintSession::reportActualWorkDuration(
ATRACE_INT(sz.c_str(), dOut);
sz = StringPrintf("adpf.%s-pid.output", idstr.c_str());
ATRACE_INT(sz.c_str(), output);
+ sz = StringPrintf("adpf.%s-stale", idstr.c_str());
+ ATRACE_INT(sz.c_str(), isStale());
+ sz = StringPrintf("adpf.%s-pid.overtime", idstr.c_str());
+ ATRACE_INT(sz.c_str(), err_sum > 0);
}
mDescriptor->update_count++;
@@ -357,8 +372,7 @@ ndk::ScopedAStatus PowerHintSession::reportActualWorkDuration(
/* apply to all the threads in the group */
if (output != 0) {
- int next_min =
- std::min(sUclampMinHighLimit, mDescriptor->current_min + static_cast<int>(output));
+ int next_min = std::min(sUclampMinHighLimit, static_cast<int>(output));
next_min = std::max(sUclampMinLowLimit, next_min);
if (std::abs(mDescriptor->current_min - next_min) > sUclampMinGranularity) {
setUclamp(next_min);