Skip to content

Commit

Permalink
DEV 22.07.09
Browse files Browse the repository at this point in the history
- 新增 sdm8g1+支持
- 改进 任务放置
- 改进 功耗估计准确度
- ...合计26个commit

Signed-off-by: Matt Yang <yccy@outlook.com>
  • Loading branch information
yc9559 committed Jul 9, 2022
1 parent b7f0436 commit 29230a3
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 98 deletions.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# 更新日志

## DEV 22.07.09

- 新增 sdm8g1+支持
- 改进 任务放置
- 改进 功耗估计准确度

## DEV 22.06.26

- 新增 移除`swjunk`
Expand Down
120 changes: 43 additions & 77 deletions config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"hintDuration": {
"idle": 0.0,
"touch": 4.0,
"trigger": 0.05,
"trigger": 0.03,
"gesture": 0.1,
"switch": 0.4,
"junk": 0.02
"junk": 0.06
}
},
"atrace": {
Expand All @@ -40,45 +40,31 @@
},
"sysfs": {
"enable": true,
"knob": {
"cpusetTa": "/dev/cpuset/top-app/cpus",
"cpusetFg": "/dev/cpuset/foreground/cpus",
"cpusetBg": "/dev/cpuset/background/cpus",
"cpusetSysBg": "/dev/cpuset/system-background/cpus",
"cpusetRe": "/dev/cpuset/restricted/cpus"
}
"knob": {}
},
"sched": {
"enable": true,
"cpumask": {
"all": [0, 1, 2, 3, 4, 5, 6, 7],
"norm": [0, 1, 2, 3, 4, 5, 6],
"perf": [4, 5, 6, 7],
"eff": [0, 1, 2, 3],
"bal": [4, 5, 6],
"max": [7],
"gtcoop": [4, 5, 6],
"gtmain": [7]
"c0": [0, 1, 2, 3],
"c1": [4, 5, 6],
"c2": [7]
},
"affinity": {
"auto": { "bg": "", "fg": "", "idle": "", "touch": "", "boost": "" },
"norm": { "bg": "norm", "fg": "norm", "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" },
"gtperf": { "bg": "norm", "fg": "norm", "idle": "all", "touch": "perf", "boost": "all" },
"gtcoop": { "bg": "norm", "fg": "norm", "idle": "perf", "touch": "gtcoop", "boost": "all" },
"gtmain": { "bg": "norm", "fg": "norm", "idle": "perf", "touch": "gtmain", "boost": "all" }
"norm": { "bg": "", "fg": "all", "idle": "all", "touch": "all", "boost": "all" },
"bg": { "bg": "", "fg": "c0", "idle": "c0", "touch": "c0", "boost": "c0" },
"ui": { "bg": "", "fg": "all", "idle": "c1", "touch": "c1", "boost": "all" },
"crit": { "bg": "", "fg": "all", "idle": "all", "touch": "c1", "boost": "c1" },
"gtcoop": { "bg": "", "fg": "all", "idle": "all", "touch": "c1", "boost": "all" },
"gtmain": { "bg": "", "fg": "all", "idle": "all", "touch": "c2", "boost": "all" }
},
"prio": {
"auto": { "bg": 0, "fg": 0, "idle": 0, "touch": 0, "boost": 0 },
"norm": { "bg": -1, "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 },
"bg": { "bg": -3, "fg": 139, "idle": 139, "touch": 139, "boost": 139 },
"coop": { "bg": -3, "fg": 124, "idle": 122, "touch": 122, "boost": 130 },
"ui": { "bg": -3, "fg": 120, "idle": 110, "touch": 98, "boost": 116 },
"main": { "bg": -3, "fg": 120, "idle": 110, "touch": 98, "boost": 100 },
"rtusr": { "bg": 98, "fg": 98, "idle": 97, "touch": 97, "boost": 98 },
"rtsys": { "bg": 97, "fg": 97, "idle": 96, "touch": 96, "boost": 97 }
},
Expand All @@ -99,10 +85,9 @@
"regex": "/system/bin/surfaceflinger",
"pinned": true,
"rules": [
{ "k": "/MAIN_THREAD/", "ac": "ui", "pc": "auto" },
{ "k": "^(app|RenderEngine)", "ac": "ui", "pc": "auto" },
{ "k": "^Binder:", "ac": "binder", "pc": "auto" },
{ "k": "^[Ss]f|Timer|Idle", "ac": "bg", "pc": "auto" },
{ "k": "/MAIN_THREAD/", "ac": "crit", "pc": "auto" },
{ "k": "^(app|RenderEngine)", "ac": "crit", "pc": "auto" },
{ "k": "^Binder:", "ac": "auto", "pc": "auto" },
{ "k": ".", "ac": "bg", "pc": "auto" }
]
},
Expand All @@ -111,8 +96,6 @@
"regex": "system_server",
"pinned": true,
"rules": [
{ "k": "^(android.anim|android.display)", "ac": "crit", "pc": "rtusr" },
{ "k": "^(Binder:|android.bg)", "ac": "binder", "pc": "auto" },
{ "k": "^(TaskSnapshot|Greezer|CachedApp|SystemPressure|SensorService)|[Mm]emory", "ac": "bg", "pc": "auto" },
{ "k": ".", "ac": "auto", "pc": "auto" }
]
Expand All @@ -135,15 +118,6 @@
"pinned": true,
"rules": [{ "k": ".", "ac": "auto", "pc": "bg" }]
},
{
"name": "Uperf",
"regex": "uperf",
"pinned": true,
"rules": [
{ "k": "HeavyWorker", "ac": "bg", "pc": "auto" },
{ "k": ".", "ac": "auto", "pc": "auto" }
]
},
{
"name": "Phone",
"regex": "com.android.phone",
Expand All @@ -160,28 +134,24 @@
"name": "App co-process",
"regex": "[.].+:",
"pinned": false,
"rules": [
{ "k": "^Binder:", "ac": "auto", "pc": "auto" },
{ "k": "^(Jit thread pool|HeapTaskDaemon|FinalizerDaemon|ReferenceQueueD)", "ac": "bg", "pc": "auto" }
]
"rules": [{ "k": "^(Jit thread pool|HeapTaskDaemon|FinalizerDaemon|ReferenceQueueD)", "ac": "bg", "pc": "auto" }]
},
{
"name": "Default rule",
"regex": ".",
"pinned": false,
"rules": [
{ "k": "/MAIN_THREAD/", "ac": "ui", "pc": "main" },
{ "k": "/MAIN_THREAD/", "ac": "ui", "pc": "ui" },
{ "k": "^(UnityMain|RenderThread |GameThread)", "ac": "gtmain", "pc": "auto" },
{ "k": "^(Unity|Worker Thread|TaskGraph|RHIThread)", "ac": "gtcoop", "pc": "auto" },
{ "k": "^Thread-", "ac": "gtperf", "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": "^(Chrome_InProc|CrRendererMain|CrGpuMain|CompositorTile)", "ac": "norm", "pc": "norm" },
{ "k": "^(Viz|Chrome_|Compositor)|[Vv]sync|mali-", "ac": "ui", "pc": "ui" },
{ "k": "^(OkHttp|Ysa|Xqa|Rx|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": "^(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": "^(JS|libweexjsb|WeexJsBridge|mqt_native|mqt_js|JavaScriptTh)", "ac": "norm", "pc": "coop" },
{ "k": "^(pool-|glide-|launcher-)|[Dd]ownload|[Ss]chedule|[Ww]ork|[Pp]ool|[Dd]efau|Fresco", "ac": "norm", "pc": "coop" },
{ "k": ".", "ac": "norm", "pc": "norm" }
]
}
Expand All @@ -196,20 +166,14 @@
"slowLimitPower": 3.0,
"fastLimitPower": 6.0,
"fastLimitCapacity": 10.0,
"fastLimitRecoverScale": 0.5,
"fastLimitRecoverScale": 0.3,
"predictThd": 0.3,
"margin": 0.25,
"burst": 0.0,
"guideCap": true,
"limitEfficiency": false
},
"sysfs": {
"cpusetTa": "0-7",
"cpusetFg": "0-6",
"cpusetBg": "0-3",
"cpusetSysBg": "0-3",
"cpusetRe": "0-6"
},
"sysfs": {},
"sched": {
"scene": "idle"
}
Expand All @@ -218,15 +182,14 @@
"balance": {
"*": {
"cpu.latencyTime": 0.2,
"cpu.slowLimitPower": 2.5,
"cpu.fastLimitPower": 4.0,
"cpu.fastLimitCapacity": 45.0,
"cpu.slowLimitPower": 2.0,
"cpu.fastLimitPower": 2.0,
"cpu.fastLimitCapacity": 20.0,
"cpu.margin": 0.2
},
"idle": {
"cpu.baseSampleTime": 0.04,
"cpu.baseSlackTime": 0.08,
"cpu.fastLimitPower": 2.5,
"cpu.predictThd": 0.3,
"cpu.limitEfficiency": true,
"sched.scene": "idle"
Expand All @@ -236,7 +199,7 @@
"sched.scene": "touch"
},
"trigger": {
"cpu.margin": 0.3,
"cpu.margin": 0.4,
"sched.scene": "touch"
},
"gesture": {
Expand All @@ -249,7 +212,9 @@
},
"switch": {
"cpu.latencyTime": 0.0,
"cpu.fastLimitPower": 7.5,
"cpu.slowLimitPower": 3.0,
"cpu.fastLimitPower": 6.0,
"cpu.fastLimitRecoverScale": 0.1,
"cpu.margin": 0.4,
"sched.scene": "boost"
}
Expand All @@ -258,14 +223,13 @@
"*": {
"cpu.latencyTime": 0.4,
"cpu.slowLimitPower": 1.0,
"cpu.fastLimitPower": 1.5,
"cpu.fastLimitPower": 1.0,
"cpu.fastLimitCapacity": 5.0,
"cpu.margin": 0.1
},
"idle": {
"cpu.baseSampleTime": 0.04,
"cpu.baseSlackTime": 0.08,
"cpu.fastLimitPower": 1.0,
"cpu.predictThd": 1.0,
"cpu.limitEfficiency": true,
"sched.scene": "idle"
Expand All @@ -275,7 +239,7 @@
"sched.scene": "touch"
},
"trigger": {
"cpu.margin": 0.3,
"cpu.margin": 0.4,
"sched.scene": "touch"
},
"gesture": {
Expand All @@ -288,17 +252,19 @@
},
"switch": {
"cpu.latencyTime": 0.0,
"cpu.slowLimitPower": 1.5,
"cpu.fastLimitPower": 3.0,
"cpu.fastLimitRecoverScale": 0.1,
"cpu.margin": 0.3,
"sched.scene": "boost"
}
},
"performance": {
"*": {
"cpu.latencyTime": 0.0,
"cpu.slowLimitPower": 5.0,
"cpu.slowLimitPower": 4.0,
"cpu.fastLimitPower": 10.0,
"cpu.fastLimitCapacity": 300.0,
"cpu.fastLimitCapacity": 360.0,
"cpu.margin": 0.4
},
"idle": {
Expand All @@ -318,7 +284,7 @@
"sched.scene": "touch"
},
"junk": {
"cpu.burst": 0.6,
"cpu.burst": 0.5,
"sched.scene": "touch"
},
"switch": {
Expand All @@ -329,8 +295,8 @@
"fast": {
"*": {
"cpu.latencyTime": 0.0,
"cpu.slowLimitPower": 3.0,
"cpu.fastLimitPower": 3.0,
"cpu.slowLimitPower": 2.5,
"cpu.fastLimitPower": 2.5,
"cpu.fastLimitCapacity": 0.0,
"cpu.margin": 0.4
},
Expand All @@ -351,7 +317,7 @@
"sched.scene": "touch"
},
"junk": {
"cpu.burst": 0.6,
"cpu.burst": 0.5,
"sched.scene": "touch"
},
"switch": {
Expand Down
4 changes: 2 additions & 2 deletions magisk/module.prop
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
id=uperf
name=Uperf
version=v3(22.06.26)
versionCode=220626
version=v3(22.07.09)
versionCode=220709
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
14 changes: 2 additions & 12 deletions magisk/script/initsvc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
BASEDIR="$(dirname $(readlink -f "$0"))"
. $BASEDIR/pathinfo.sh
. $BASEDIR/libcommon.sh
. $BASEDIR/libuperf.sh

# create busybox symlinks
$BIN_PATH/busybox/busybox --install -s $BIN_PATH/busybox
Expand All @@ -33,15 +34,4 @@ echo "sh $SCRIPT_PATH/powercfg_main.sh \"\$1\"" >>/data/powercfg.sh
wait_until_login

sh $SCRIPT_PATH/powercfg_once.sh

# raise inotify limit in case file sync existed
lock_val "1048576" /proc/sys/fs/inotify/max_queued_events
lock_val "1048576" /proc/sys/fs/inotify/max_user_watches
lock_val "1024" /proc/sys/fs/inotify/max_user_instances

mv $USER_PATH/uperf_log.txt $USER_PATH/uperf_log.txt.bak
if [ -f $BIN_PATH/libc++_shared.so ]; then
ASAN_LIB="$(ls $BIN_PATH/libclang_rt.asan-*-android.so)"
export LD_PRELOAD="$ASAN_LIB $BIN_PATH/libc++_shared.so"
fi
$BIN_PATH/uperf $USER_PATH/uperf.json -o $USER_PATH/uperf_log.txt
uperf_start
12 changes: 10 additions & 2 deletions magisk/script/libsysinfo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,18 @@ _get_lahaina_type() {
fi
}

_get_taro_type() {
if [ "$(get_maxfreq 4)" -gt 2700000 ]; then
echo "sdm8g1+"
else
echo "sdm8g1"
fi
}

# $1:board_name
get_config_name() {
case "$1" in
"taro") echo "sdm8g1" ;;
"taro") echo "$(_get_taro_type)" ;;
"lahaina") echo "$(_get_lahaina_type)" ;;
"shima") echo "$(_get_lahaina_type)" ;;
"yupik") echo "$(_get_lahaina_type)" ;;
Expand All @@ -121,7 +129,7 @@ get_config_name() {
"sdm660") echo "sdm660" ;;
"sdm636") echo "sdm660" ;;
"trinket") echo "sdm665" ;; # sdm665
"bengal") echo "sdm665" ;; # sdm662
"bengal") echo "sdm665" ;; # sdm662
"msm8976") echo "sdm652" ;;
"msm8956") echo "sdm650" ;;
"msm8998") echo "sdm835" ;;
Expand Down
Loading

0 comments on commit 29230a3

Please sign in to comment.