Skip to content

Commit

Permalink
DEV 22.06.05
Browse files Browse the repository at this point in the history
- 新增 更多兼容性CPU频率写入器
- 新增 兼容性生成CPU频率表
- 修复 微信小程序启动缓慢
- 修复 前台程序破音
- 修复 部分崩溃问题
- 修复 部分高通平台息屏功耗过高,感谢@NepPoseidon
- ...合计64个commit

Signed-off-by: Matt Yang <yccy@outlook.com>
  • Loading branch information
yc9559 committed Jun 5, 2022
1 parent 82b8c89 commit 12bb192
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 109 deletions.
9 changes: 9 additions & 0 deletions changelog.md
@@ -1,5 +1,14 @@
# 更新日志

## DEV 22.06.05

- 新增 更多兼容性CPU频率写入器
- 新增 兼容性生成CPU频率表
- 修复 微信小程序启动缓慢
- 修复 前台程序破音
- 修复 部分崩溃问题
- 修复 部分高通平台息屏功耗过高,感谢@NepPoseidon

## DEV 22.05.20

- 新增 开放配置文件自定义
Expand Down
9 changes: 6 additions & 3 deletions config/README.md
Expand Up @@ -67,7 +67,7 @@ touch --> idle: timeout / not rendering
| ------- | ----- | -------------------------------------------------- |
| idle | float | (单位:秒)默认 |
| touch | float | (单位:秒)触摸屏幕/按下按键 |
| trigger | float | (单位:秒)点击操作离开屏幕/滑动操作起始 |
| trigger | float | (单位:秒)点击操作离开屏幕/松开按键/滑动操作起始 |
| gesture | float | (单位:秒)全面屏手势 |
| switch | float | (单位:秒)应用切换动画/点亮屏幕 |
| junk | float | (单位:秒)touch/gesture 中 sfanalysis 检测到掉帧 |
Expand Down Expand Up @@ -124,6 +124,8 @@ touch --> idle: timeout / not rendering

仅需一组实测数据即可完成标定。经验模型结合实测数据,保持模型精度并显著减少平台适配工作量。类型为对象列表,与 CPU 集群顺序一致。

注:**典型频点并非调频最大值**,大于典型频点的功耗使用模型外插计算。

| 字段 | 类型 | 描述 |
| ------------ | ----- | --------------------------------------------- |
| efficiency | int | 单核相对同频性能(以Cortex-A53@1.0Ghz为 100) |
Expand Down Expand Up @@ -275,7 +277,7 @@ touch --> idle: timeout / not rendering
2. 计算每个集群的性能负载和性能需求
- 如果 CPU 集群最大负载增加量大于`predictThd`,则性能需求计算使用预测的负载值
- 根据性能负载计算性能需求,`demand = load + (1 - load) * (margin + burst)`
- `burst``margin`不同,即使当前负载较低也能计算到较大的性能需求
-`margin`不同,`burst`非零时即使当前负载较低也能计算到较大的性能需求
3. 计算性能需求对应的工作频点
- CPU 整体如果存在多个集群,它们共享整个`latencyTime`,表示从性能最低的集群的最低频到性能最高的集群的最高频率的最小延迟
- 由于离散采样周期的存在,实测 CPU 整体升频最小延迟一般会大于设定的`latencyTime`
Expand All @@ -286,6 +288,7 @@ touch --> idle: timeout / not rendering
- 如果当前能耗大于`slowLimitPower`,能耗缓冲池余量减少
- 如果当前能耗小于`slowLimitPower`,能耗缓冲池余量增加,并按照`fastLimitRecoverScale`缩放因子恢复,总量不超过`fastLimitCapacity`
- 限制 CPU 功耗根据能耗模型选择最优频率限制,在限定功耗下提供最佳整体性能
- `burst`非零时忽略`fastLimitPower``slowLimitPower`限制
5. 引导任务调度器放置任务
- 启用`guideCap`后,根据能耗模型调节集群性能容量,引导 EAS 任务调度器把任务放置到能效最佳的集群
- 启用`limitEfficiency`后,低性能集群最大频点能效值不高于高性能集群当前频点的能效值
Expand All @@ -303,7 +306,7 @@ touch --> idle: timeout / not rendering
| fastLimitRecoverScale | float | (0.1~10.0)CPU 短期功耗限制容量恢复缩放因子 |
| predictThd | float | (0.1~1.0)CPU 集群最大负载增加量大于该阈值,则集群调频使用预测的负载值,并忽略`latencyTime` |
| margin | float | (0.0~1.0)调频提供的性能余量 |
| burst | float | (0.0~1.0)调频提供的额外性能余量,非零时忽略`latencyTime` |
| burst | float | (0.0~1.0)调频提供的额外性能余量,非零时忽略`latencyTime`和功耗限制 |
| guideCap | bool | 启用引导 EAS 任务调度负载转移 |
| limitEfficiency | bool | 启用 CPU 整体能效限制 |

Expand Down
161 changes: 78 additions & 83 deletions config/template.json
Expand Up @@ -12,9 +12,9 @@
"touch": 4.0,
"trigger": 0.02,
"gesture": 0.1,
"switch": 0.3,
"junk": 0.04,
"swjunk": 0.04
"switch": 0.4,
"junk": 0.02,
"swjunk": 0.02
}
},
"atrace": {
Expand All @@ -25,7 +25,7 @@
},
"input": {
"enable": true,
"swipeThd": 0.005,
"swipeThd": 0.01,
"gestureThdX": 0.03,
"gestureThdY": 0.03,
"gestureDelayTime": 2.0,
Expand Down Expand Up @@ -62,25 +62,25 @@
"gtmain": [7]
},
"affinity": {
"norm": { "bg": "", "fg": "norm", "idle": "all", "touch": "all", "boost": "all" },
"bg": { "bg": "eff", "fg": "eff", "idle": "eff", "touch": "eff", "boost": "" },
"coop": { "bg": "eff", "fg": "eff", "idle": "norm", "touch": "norm", "boost": "" },
"trig": { "bg": "", "fg": "eff", "idle": "eff", "touch": "bal", "boost": "bal" },
"crit": { "bg": "", "fg": "norm", "idle": "", "touch": "bal", "boost": "bal" },
"mix": { "bg": "", "fg": "norm", "idle": "all", "touch": "bal", "boost": "bal" },
"main": { "bg": "", "fg": "norm", "idle": "", "touch": "bal", "boost": "norm" },
"binder": { "bg": "", "fg": "norm", "idle": "norm", "touch": "bal", "boost": "perf" },
"gtcoop": { "bg": "", "fg": "norm", "idle": "perf", "touch": "gtcoop", "boost": "gtcoop" },
"gtmain": { "bg": "", "fg": "norm", "idle": "perf", "touch": "gtmain", "boost": "gtmain" },
"auto": { "bg": "", "fg": "", "idle": "", "touch": "", "boost": "" }
"auto": { "bg": "", "fg": "", "idle": "", "touch": "", "boost": "" },
"norm": { "bg": "norm", "fg": "eff", "idle": "all", "touch": "norm", "boost": "norm" },
"bg": { "bg": "norm", "fg": "eff", "idle": "eff", "touch": "eff", "boost": "eff" },
"coop": { "bg": "norm", "fg": "norm", "idle": "norm", "touch": "norm", "boost": "all" },
"ui": { "bg": "norm", "fg": "norm", "idle": "norm", "touch": "bal", "boost": "bal" },
"binder": { "bg": "norm", "fg": "norm", "idle": "norm", "touch": "norm", "boost": "perf" },
"crit": { "bg": "norm", "fg": "norm", "idle": "bal", "touch": "bal", "boost": "bal" },
"gtcoop": { "bg": "norm", "fg": "norm", "idle": "perf", "touch": "gtcoop", "boost": "all" },
"gtmain": { "bg": "norm", "fg": "norm", "idle": "perf", "touch": "gtmain", "boost": "all" }
},
"prio": {
"rtsys": { "bg": 97, "fg": 97, "idle": 97, "touch": 97, "boost": 96 },
"auto": { "bg": 0, "fg": 0, "idle": 0, "touch": 0, "boost": 0 },
"norm": { "bg": -3, "fg": -1, "idle": -1, "touch": -1, "boost": -1 },
"bg": { "bg": -3, "fg": 139, "idle": 139, "touch": 139, "boost": -3 },
"coop": { "bg": -3, "fg": 121, "idle": 121, "touch": 121, "boost": -3 },
"ui": { "bg": -3, "fg": 120, "idle": 110, "touch": 98, "boost": 116 },
"main": { "bg": -3, "fg": 120, "idle": 110, "touch": 104, "boost": 98 },
"rtusr": { "bg": 98, "fg": 98, "idle": 98, "touch": 98, "boost": 97 },
"ux": { "bg": -3, "fg": 122, "idle": 104, "touch": 104, "boost": 100 },
"bg": { "bg": -3, "fg": -3, "idle": -3, "touch": -3, "boost": -3 },
"norm": { "bg": -3, "fg": -1, "idle": -1, "touch": -1, "boost": -3 },
"auto": { "bg": 0, "fg": 0, "idle": 0, "touch": 0, "boost": 0 }
"rtsys": { "bg": 97, "fg": 97, "idle": 97, "touch": 97, "boost": 96 }
},
"rules": [
{
Expand All @@ -99,12 +99,11 @@
"regex": "/system/bin/surfaceflinger",
"pinned": true,
"rules": [
{ "k": "/MAIN_THREAD/", "ac": "trig", "pc": "rtsys" },
{ "k": "^RenderEngine", "ac": "crit", "pc": "rtsys" },
{ "k": "/MAIN_THREAD/", "ac": "ui", "pc": "auto" },
{ "k": "^(app|RenderEngine)", "ac": "ui", "pc": "auto" },
{ "k": "^Binder:", "ac": "binder", "pc": "auto" },
{ "k": "^app", "ac": "trig", "pc": "rtsys" },
{ "k": "^[Ss]f|Timer|Idle", "ac": "bg", "pc": "rtsys" },
{ "k": ".", "ac": "bg", "pc": "rtsys" }
{ "k": "^[Ss]f|Timer|Idle", "ac": "bg", "pc": "auto" },
{ "k": ".", "ac": "bg", "pc": "auto" }
]
},
{
Expand All @@ -114,17 +113,15 @@
"rules": [
{ "k": "^(android.anim|android.display|android.bg)", "ac": "crit", "pc": "rtusr" },
{ "k": "^Binder:", "ac": "binder", "pc": "auto" },
{ "k": "^[Ii]nput", "ac": "trig", "pc": "ux" },
{ "k": "^(Jit thread pool|HeapTaskDaemon|FinalizerDaemon|ReferenceQueueD)", "ac": "binder", "pc": "bg" },
{ "k": "^(TaskSnapshot|Greezer|CachedApp|SystemPressure|SensorService)|[Mm]emory", "ac": "bg", "pc": "auto" },
{ "k": ".", "ac": "coop", "pc": "auto" }
{ "k": ".", "ac": "auto", "pc": "auto" }
]
},
{
"name": "Phone",
"regex": "com.android.phone",
"name": "SystemUI",
"regex": "com.android.systemui",
"pinned": true,
"rules": [{ "k": ".", "ac": "coop", "pc": "auto" }]
"rules": [{ "k": "^(Jit thread pool|HeapTaskDaemon|FinalizerDaemon|ReferenceQueueD)", "ac": "bg", "pc": "auto" }]
},
{
"name": "MediaProvider",
Expand All @@ -134,7 +131,7 @@
},
{
"name": "Memory reclaim",
"regex": "^(kswapd0|kcompactd0)",
"regex": "swapd|compactd",
"pinned": true,
"rules": [{ "k": ".", "ac": "auto", "pc": "bg" }]
},
Expand All @@ -148,10 +145,10 @@
]
},
{
"name": "SystemUI",
"regex": "com.android.systemui",
"name": "Phone",
"regex": "com.android.phone",
"pinned": false,
"rules": [{ "k": "^(Jit thread pool|HeapTaskDaemon|FinalizerDaemon|ReferenceQueueD)", "ac": "bg", "pc": "norm" }]
"rules": [{ "k": ".", "ac": "auto", "pc": "auto" }]
},
{
"name": "Other system processes",
Expand All @@ -164,37 +161,26 @@
"regex": "[.].+:",
"pinned": false,
"rules": [
{ "k": "^Binder:", "ac": "norm", "pc": "norm" },
{ "k": "^(Jit thread pool|HeapTaskDaemon|FinalizerDaemon|ReferenceQueueD)", "ac": "bg", "pc": "norm" }
{ "k": "^Binder:", "ac": "auto", "pc": "auto" },
{ "k": "^(Jit thread pool|HeapTaskDaemon|FinalizerDaemon|ReferenceQueueD)", "ac": "bg", "pc": "auto" }
]
},
{
"name": "Default rule",
"regex": ".",
"pinned": false,
"rules": [
{ "k": "/MAIN_THREAD/", "ac": "main", "pc": "ux" },
{ "k": "[.]ui$", "ac": "main", "pc": "ux" },
{ "k": "^(UnityMain|RenderThread |GameThread)", "ac": "gtmain", "pc": "ux" },
{ "k": "^(Unity|Worker Thread|TaskGraph|RHIThread)", "ac": "gtcoop", "pc": "ux" },
{ "k": "^(NativeThread|Timer-)", "ac": "bg", "pc": "norm" },
{ "k": "^(Chrome_InProc|CrRendererMain|CrGpuMain|CompositorTile)", "ac": "coop", "pc": "norm" },
{ "k": "^(Viz|Chrome_|Compositor)", "ac": "coop", "pc": "ux" },
{ "k": "^(JS|libweexjsb|WeexJsBridge|mqt_native|mqt_js|JavaScriptTh)", "ac": "coop", "pc": "bg" },
{ "k": "^Thread-", "ac": "mix", "pc": "norm" },
{ "k": "[Aa]sync", "ac": "norm", "pc": "bg" },
{ "k": "[Vv]sync|mali-", "ac": "coop", "pc": "ux" },
{ "k": "^(pool-|glide-|launcher-)", "ac": "coop", "pc": "bg" },
{ "k": "^(OkHttp|Ysa|Xqa|Rx|Fresco|TVKDL|APM|tp-|cgi-|ODCP-|Bugly|xlog_)", "ac": "bg", "pc": "norm" },
{ "k": "^(xg_vip_service|Profile|SearchDaemon|default_matrix|FrameDecoder|FrameSeq)", "ac": "bg", "pc": "norm" },
{ "k": "^([Dd]ownload|ThreadPoolForeg|launcher-idle-|fe_single_pool)", "ac": "bg", "pc": "norm" },
{ "k": "[Ss]chedule|[.][.][.]$|[.]so$", "ac": "bg", "pc": "norm" },
{ "k": "[Ww]ork|[Pp]ool", "ac": "coop", "pc": "norm" },
{ "k": "/MAIN_THREAD/", "ac": "ui", "pc": "main" },
{ "k": "^(UnityMain|RenderThread |GameThread)", "ac": "gtmain", "pc": "auto" },
{ "k": "^(Unity|Worker Thread|TaskGraph|RHIThread)", "ac": "gtcoop", "pc": "auto" },
{ "k": "^(RenderThread|GLThread|JNISurfaceText|IJK_External_Re)|[Aa]nim|([.]raster|[.]ui)$", "ac": "ui", "pc": "ui" },
{ "k": "^(Chrome_InProc|CrRendererMain|CrGpuMain|CompositorTile)", "ac": "coop", "pc": "coop" },
{ "k": "^(Viz|Chrome_|Compositor)|[Vv]sync|mali-", "ac": "norm", "pc": "ui" },
{ "k": "^(OkHttp|Ysa|Xqa|Rx|Fresco|TVKDL|APM|tp-|cgi-|ODCP-|Bugly|xlog_)", "ac": "bg", "pc": "auto" },
{ "k": "^(xg_vip_service|Profile|SearchDaemon|default_matrix|FrameDecoder|FrameSeq)", "ac": "bg", "pc": "auto" },
{ "k": "^(GPU completion|HWC release|hwui|FramePolicy|ScrollPolicy|ged-swd)", "ac": "bg", "pc": "rtusr" },
{ "k": "^(RenderThread|GLThread|JNISurfaceText|IJK_External_Re)", "ac": "main", "pc": "ux" },
{ "k": "[.]raster$", "ac": "crit", "pc": "ux" },
{ "k": "[Aa]nim", "ac": "crit", "pc": "ux" },
{ "k": "^Binder:", "ac": "trig", "pc": "auto" },
{ "k": "^(JS|libweexjsb|WeexJsBridge|mqt_native|mqt_js|JavaScriptTh)", "ac": "coop", "pc": "coop" },
{ "k": "^(pool-|glide-|launcher-)|[Dd]ownload|[Ss]chedule|[Ww]ork|[Pp]ool|[Dd]efau", "ac": "coop", "pc": "coop" },
{ "k": ".", "ac": "norm", "pc": "norm" }
]
}
Expand Down Expand Up @@ -239,43 +225,48 @@
"idle": {
"cpu.baseSampleTime": 0.04,
"cpu.baseSlackTime": 0.08,
"cpu.predictThd": 0.1,
"cpu.limitEfficiency": true,
"sched.scene": "idle"
},
"touch": {
"cpu.baseSampleTime": 0.04,
"sched.scene": "touch"
},
"trigger": {
"cpu.margin": 0.7,
"cpu.margin": 0.6,
"sched.scene": "touch"
},
"gesture": {
"cpu.margin": 0.7,
"cpu.margin": 0.6,
"sched.scene": "touch"
},
"junk": {
"cpu.burst": 0.55,
"cpu.baseSampleTime": 0.04,
"cpu.burst": 0.5,
"sched.scene": "touch"
},
"switch": {
"cpu.latencyTime": 0.0,
"cpu.slowLimitPower": 5.0,
"cpu.guideCap": false,
"cpu.margin": 0.3,
"cpu.fastLimitCapacity": 0.0,
"cpu.margin": 0.4,
"sched.scene": "boost"
},
"swjunk": {
"cpu.latencyTime": 0.0,
"cpu.slowLimitPower": 5.0,
"cpu.guideCap": false,
"cpu.margin": 0.3,
"cpu.burst": 0.55,
"cpu.fastLimitCapacity": 0.0,
"cpu.margin": 0.4,
"cpu.burst": 0.5,
"sched.scene": "boost"
}
},
"powersave": {
"*": {
"cpu.latencyTime": 0.5,
"cpu.slowLimitPower": 1.5,
"cpu.fastLimitPower": 3.0,
"cpu.latencyTime": 0.4,
"cpu.slowLimitPower": 1.0,
"cpu.fastLimitPower": 2.5,
"cpu.fastLimitCapacity": 0.5,
"cpu.margin": 0.1
},
Expand All @@ -287,31 +278,35 @@
"sched.scene": "idle"
},
"touch": {
"cpu.baseSampleTime": 0.04,
"sched.scene": "touch"
},
"trigger": {
"cpu.margin": 0.4,
"cpu.margin": 0.6,
"sched.scene": "touch"
},
"gesture": {
"cpu.margin": 0.4,
"cpu.margin": 0.6,
"sched.scene": "touch"
},
"junk": {
"cpu.burst": 0.45,
"cpu.baseSampleTime": 0.04,
"cpu.burst": 0.3,
"sched.scene": "touch"
},
"switch": {
"cpu.slowLimitPower": 3.0,
"cpu.guideCap": false,
"cpu.margin": 0.2,
"cpu.latencyTime": 0.0,
"cpu.slowLimitPower": 2.5,
"cpu.fastLimitCapacity": 0.0,
"cpu.margin": 0.3,
"sched.scene": "boost"
},
"swjunk": {
"cpu.slowLimitPower": 3.0,
"cpu.guideCap": false,
"cpu.margin": 0.2,
"cpu.burst": 0.45,
"cpu.latencyTime": 0.0,
"cpu.slowLimitPower": 2.5,
"cpu.fastLimitCapacity": 0.0,
"cpu.margin": 0.3,
"cpu.burst": 0.3,
"sched.scene": "boost"
}
},
Expand Down Expand Up @@ -340,15 +335,15 @@
"sched.scene": "touch"
},
"junk": {
"cpu.burst": 0.55,
"cpu.burst": 0.5,
"sched.scene": "touch"
},
"switch": {
"cpu.burst": 0.2,
"sched.scene": "boost"
},
"swjunk": {
"cpu.burst": 0.55,
"cpu.burst": 0.5,
"sched.scene": "boost"
}
},
Expand Down Expand Up @@ -377,15 +372,15 @@
"sched.scene": "touch"
},
"junk": {
"cpu.burst": 0.55,
"cpu.burst": 0.5,
"sched.scene": "touch"
},
"switch": {
"cpu.burst": 0.2,
"sched.scene": "boost"
},
"swjunk": {
"cpu.burst": 0.55,
"cpu.burst": 0.5,
"sched.scene": "boost"
}
}
Expand Down
4 changes: 2 additions & 2 deletions magisk/module.prop
@@ -1,7 +1,7 @@
id=uperf
name=Uperf
version=v3(22.05.20)
versionCode=220520
version=v3(22.06.05)
versionCode=220605
author=Matt Yang
description=Userspace performance controller for android. Repo: https://github.com/yc9559/uperf/
updateJson=https://github.com/yc9559/uperf/raw/master/version.json

0 comments on commit 12bb192

Please sign in to comment.