├── .gitignore ├── LICENSE ├── NOTICE ├── README.md ├── changelog.md ├── config ├── README.md ├── e1380.json ├── e2100.json ├── e2200.json ├── e9810.json ├── e9820.json ├── gs101.json ├── gs201.json ├── kirin65x.json ├── kirin710.json ├── kirin955.json ├── kirin960.json ├── kirin970.json ├── kirin980.json ├── mt6580.json ├── mtd1000.json ├── mtd1200.json ├── mtd7000.json ├── mtd720.json ├── mtd8100.json ├── mtd820.json ├── mtd9000.json ├── mtd920.json ├── mtd9200.json ├── mtg80.json ├── mtg90t.json ├── mtg99.json ├── mtp35.json ├── mtp70.json ├── mtp90.json ├── mtx20.json ├── perapp_powermode.txt ├── sdm439.json ├── sdm4g2.json ├── sdm616.json ├── sdm625.json ├── sdm653.json ├── sdm660.json ├── sdm665.json ├── sdm675.json ├── sdm680.json ├── sdm695.json ├── sdm710.json ├── sdm730.json ├── sdm750.json ├── sdm765.json ├── sdm778.json ├── sdm780.json ├── sdm7g1.json ├── sdm820.json ├── sdm835.json ├── sdm845.json ├── sdm855.json ├── sdm865.json ├── sdm888.json ├── sdm8g1+.json ├── sdm8g1.json ├── sdm8g2.json ├── sdm8g3.json ├── sp9863.json ├── t606.json ├── t618.json ├── t710.json ├── t770.json └── template.json ├── magisk ├── META-INF │ └── com │ │ └── google │ │ └── android │ │ ├── update-binary │ │ └── updater-script ├── bin │ ├── busybox │ │ └── busybox │ └── uperf ├── config │ ├── e1380.json │ ├── e2100.json │ ├── e2200.json │ ├── e9810.json │ ├── e9820.json │ ├── gs101.json │ ├── gs201.json │ ├── gs301.json │ ├── kirin65x.json │ ├── kirin710.json │ ├── kirin955.json │ ├── kirin960.json │ ├── kirin970.json │ ├── kirin980.json │ ├── mt6580.json │ ├── mtd1000.json │ ├── mtd1200.json │ ├── mtd7000.json │ ├── mtd720.json │ ├── mtd8100.json │ ├── mtd820.json │ ├── mtd8300.json │ ├── mtd9000.json │ ├── mtd920.json │ ├── mtd9200.json │ ├── mtg80.json │ ├── mtg90t.json │ ├── mtg99.json │ ├── mtp35.json │ ├── mtp70.json │ ├── mtp90.json │ ├── mtx20.json │ ├── perapp_powermode.txt │ ├── sdm210.json │ ├── sdm439.json │ ├── sdm4g2.json │ ├── sdm616.json │ ├── sdm625.json │ ├── sdm653.json │ ├── sdm660.json │ ├── sdm665.json │ ├── sdm675.json │ ├── sdm680.json │ ├── sdm695.json │ ├── sdm7+g3.json │ ├── sdm710.json │ ├── sdm730.json │ ├── sdm750.json │ ├── sdm765.json │ ├── sdm778.json │ ├── sdm780.json │ ├── sdm7g1.json │ ├── sdm820.json │ ├── sdm835.json │ ├── sdm845.json │ ├── sdm855.json │ ├── sdm865.json │ ├── sdm888.json │ ├── sdm8g1+.json │ ├── sdm8g1.json │ ├── sdm8g2.json │ ├── sdm8g3.json │ ├── sp9863.json │ ├── t606.json │ ├── t618.json │ ├── t710.json │ └── t770.json ├── customize.sh ├── initsvc.sh ├── libcgroup.sh ├── libcommon.sh ├── libpowercfg.sh ├── libsysinfo.sh ├── libuperf.sh ├── miui_migt.sh ├── module.prop ├── modules │ └── asoulopt.zip ├── pathinfo.sh ├── platform_special.sh ├── post-fs-data.sh ├── powercfg.json ├── powercfg_main.sh ├── powercfg_once.sh ├── script │ ├── initsvc.sh │ ├── libcgroup.sh │ ├── libcommon.sh │ ├── libpowercfg.sh │ ├── libsysinfo.sh │ ├── libuperf.sh │ ├── miui_migt.sh │ ├── pathinfo.sh │ ├── platform_special.sh │ ├── powercfg.json │ ├── powercfg_main.sh │ ├── powercfg_once.sh │ ├── setup.sh │ └── vtools_powercfg.sh ├── service.sh ├── setup.sh ├── system.prop ├── system │ └── vendor │ │ ├── etc │ │ ├── power_app_cfg.xml │ │ ├── powercontable.xml │ │ └── powerscntbl.xml │ │ └── lib64 │ │ └── libthermalclient.so ├── uninstall.sh └── vtools_powercfg.sh ├── media ├── adjusted_demand_capacity_relation.png ├── alipay-qr.png ├── android_am.png ├── fingerprint.png ├── render_restart.png ├── render_stop.png ├── sflag.png └── wechat_resume.png └── version.json /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | /.vscode 3 | /build 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | Copyright 2021-2022 Matt Yang 180 | 181 | Licensed under the Apache License, Version 2.0 (the "License"); 182 | you may not use this file except in compliance with the License. 183 | You may obtain a copy of the License at 184 | 185 | http://www.apache.org/licenses/LICENSE-2.0 186 | 187 | Unless required by applicable law or agreed to in writing, software 188 | distributed under the License is distributed on an "AS IS" BASIS, 189 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 190 | See the License for the specific language governing permissions and 191 | limitations under the License. 192 | -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | # 更新日志 2 | 3 | ## Uperf-Game-Turbo1.43 4 | 5 | 【更新内容】 6 | 7 | ✅ 修复部分冲突问题 8 | ✅ 优化运行速度 9 | ✅ 增加语言检测 10 | ✅ 增加安装倒计时 11 | ✅ 安装逻辑优化,安装程序优化 12 | ✅ 调整调度策略 13 | ✅ 调整处理器配置,优化使用体验 14 | ✅ 部分季节性调整 15 | ✅ 调整一些性能释放策略 16 | ✅ 修复部分卡顿问题 17 | ✅ 修复部分处理器异常功耗问题 18 | ✅ 更新内置 ASOUL 版本 19 | 20 | 【Update Details】 21 | 22 | ✅ Fixed certain compatibility issues 23 | ✅ Optimized performance speed 24 | ✅ Added language detection 25 | ✅ Added installation countdown timer 26 | ✅ Improved installation logic and installer optimization 27 | ✅ Adjusted scheduling strategy 28 | ✅ Tweaked processor configurations for better user experience 29 | ✅ Seasonal adjustments 30 | ✅ Adjusted some performance release strategies 31 | ✅ Fixed occasional stuttering issues 32 | ✅ Fixed abnormal power consumption in some processors 33 | ✅ Updated built-in ASOUL version 34 | -------------------------------------------------------------------------------- /config/README.md: -------------------------------------------------------------------------------- 1 | # Uperf v3 配置文件说明 2 | 3 | Uperf v3 使用插件化的软件结构设计,每个功能模块均可拥有独立的配置参数空间。 4 | 5 | ## meta/元信息 6 | 7 | | 字段 | 类型 | 描述 | 8 | | ------ | ------ | ------------------ | 9 | | name | string | 配置文件的名称 | 10 | | author | string | 配置文件的作者信息 | 11 | 12 | ## modules/模块定义 13 | 14 | 功能模块的静态参数段,仅在模块实例化时读取一次,用于开关功能、定义模型参数等。 15 | 16 | ### switcher/动态配置切换器 17 | 18 | 根据关联的 native 层信号,跳转对应的 hint 状态切换,应用对应的动态参数,并持续指定时长。用户可定义多个性能配置,每个性能配置有各个 hint 的动态参数。动态参数的默认值定义在`/initials`,动态参数的动态值定义在`/presets`。如果在写入`/presets`定义了`powersave`和`balance`两个性能配置,那么`switchInode`文件允许写入`auto`、`powersave`和`balance`,其中`auto`表示启用`内置分APP性能配置切换器`。 19 | 20 | 注:由于是基础模块,此模块**不可关闭**。 21 | 22 | 内置分 APP 性能配置切换器的规则样例如下,包名按大小写敏感的全字匹配。行首为`*`表示默认规则,行首为`-`表示熄屏规则,**必须包含默认和熄屏规则**。 23 | 24 | ``` 25 | # 分应用性能模式配置 26 | # Per-app dynamic power mode rule 27 | # '-' means offscreen rule 28 | # '*' means default rule 29 | 30 | com.miHoYo.Yuanshen fast 31 | - balance 32 | * balance 33 | ``` 34 | 35 | | 字段 | 类型 | 描述 | 36 | | ------------ | ------ | ------------------------------ | 37 | | switchInode | string | 监听手动切换性能模式的文件节点 | 38 | | perapp | string | 内置分 APP 性能配置文件路径 | 39 | | hintDuration | object | 每个 hint 的最长持续时间 | 40 | 41 | #### hintDuration/hint 最长持续时间 42 | 43 | 各个 hint 使用状态机完成跳转,状态转移图如下: 44 | 45 | ```mermaid 46 | stateDiagram-v2 47 | 48 | [*] --> idle 49 | idle --> touch: pressed touch / pressed button 50 | idle --> switch: woke up screen 51 | touch --> trigger: released touch / started scrolling 52 | touch --> gesture: detected fullscreen gesture 53 | touch --> switch: detected window animation 54 | touch --> junk: detected junk 55 | gesture --> switch: detected window animation 56 | gesture --> junk: detected junk 57 | junk --> touch: timeout / finished junk 58 | trigger --> touch: timeout / not rendering 59 | gesture --> touch: timeout / not rendering 60 | switch --> touch: timeout / not rendering 61 | touch --> idle: timeout / not rendering 62 | ``` 63 | 64 | | 字段 | 类型 | 描述 | 65 | | ------- | ----- | -------------------------------------------------- | 66 | | idle | float | (单位:秒)默认 | 67 | | touch | float | (单位:秒)触摸屏幕/按下按键 | 68 | | trigger | float | (单位:秒)点击操作离开屏幕/松开按键/滑动操作起始 | 69 | | gesture | float | (单位:秒)全面屏手势 | 70 | | switch | float | (单位:秒)应用切换动画/点亮屏幕 | 71 | | junk | float | (单位:秒)touch/gesture 中 sfanalysis 检测到掉帧 | 72 | 73 | ### atrace/数据打点 74 | 75 | 用于 uperf 程序调试。 76 | 77 | | 字段 | 类型 | 描述 | 78 | | ------ | ---- | ------------ | 79 | | enable | bool | 启用数据打点 | 80 | 81 | ### log/日志级别 82 | 83 | 用于 uperf 配置文件调试。 84 | 85 | | 字段 | 类型 | 描述 | 86 | | ----- | ------ | ----------------------------------------------------- | 87 | | level | string | 日志级别,可用`err`、`warn`、`info`、`debug`、`trace` | 88 | 89 | ### input/用户输入监听 90 | 91 | 监听用户触摸屏触摸操作、按键操作、鼠标操作。支持输入设备热插拔。 92 | 93 | | 字段 | 类型 | 描述 | 94 | | ---------------- | ----- | ------------------------------------------------ | 95 | | enable | bool | 启用用户输入监听 | 96 | | swipeThd | float | 单次触摸轨迹百分比长度超过该阈值,判定为滑动操作 | 97 | | gestureThdX | float | 全面屏手势起始 X 轴百分比位置 | 98 | | gestureThdY | float | 全面屏手势起始 Y 轴百分比位置 | 99 | | gestureDelayTime | float | 暂不使用 | 100 | | holdEnterTime | float | 暂不使用 | 101 | 102 | ### sfanalysis/SurfaceFlinger 信号分析 103 | 104 | 接收 sfanalysis 模块在 SurfaceFlinger 内部的信号分析结果。检测到掉帧触发 hint,渲染结束提前结束 hint。 105 | 106 | | 字段 | 类型 | 描述 | 107 | | ------------------- | ----- | ------------------------------------------------ | 108 | | enable | bool | 启用 SurfaceFlinger 信号分析 | 109 | | renderIdleSlackTime | float | (单位:秒)渲染结束保持一段时间,判定为渲染结束 | 110 | 111 | ### cpu/用户态 CPU 调频 112 | 113 | 基于能耗模型的用户态 CPU 调频器,使能 HMP/EAS 全平台统一体验。根据功耗模型计算每个频点的每瓦性能,选择最佳的频率限制。 114 | 115 | | 字段 | 类型 | 描述 | 116 | | ---------- | ------ | ------------------- | 117 | | enable | bool | 启用用户态 CPU 调频 | 118 | | powerModel | object | CPU 能耗模型 | 119 | 120 | #### powerModel/能耗模型 121 | 122 | 仅需一组实测数据即可完成标定。经验模型结合实测数据,保持模型精度并显著减少平台适配工作量。类型为对象列表,与 CPU 集群顺序一致。 123 | 124 | 注:**典型频点并非调频最大值**,大于典型频点的功耗使用模型外插计算。 125 | 126 | | 字段 | 类型 | 描述 | 127 | | ------------ | ----- | --------------------------------------------- | 128 | | efficiency | int | 单核相对同频性能(以Cortex-A53@1.0Ghz为 100) | 129 | | nr | int | 集群内核心数量 | 130 | | typicalPower | float | (单位:瓦)单核典型功耗 | 131 | | typicalFreq | float | (单位:千兆赫)单核典型频点 | 132 | | sweetFreq | float | (单位:千兆赫)单核甜点交界频点 | 133 | | plainFreq | float | (单位:千兆赫)单核线性交界频点 | 134 | | freeFreq | float | (单位:千兆赫)单核最低功耗频点 | 135 | 136 | ### sysfs/内核节点写入器 137 | 138 | 用户态性能控制器的核心功能,为不同场景设置不同的内核参数。此模块高度优化,写入目标值开销极低。 139 | 140 | | 字段 | 类型 | 描述 | 141 | | ------ | ------ | ------------------ | 142 | | enable | bool | 启用内核节点写入器 | 143 | | knob | object | 内核节点定义 | 144 | 145 | #### knob/内核节点定义 146 | 147 | 按键值对定义: 148 | 149 | - 键:内核节点名称 150 | - 值:内核节点文件路径 151 | 152 | 例子: 153 | 154 | ```json 155 | "cpusetTa": "/dev/cpuset/top-app/cpus" 156 | ``` 157 | 158 | ### sched/识别上下文的任务调度器 159 | 160 | 在相同的能耗下,改进 QoS 提升用户感知的流畅度。正则匹配进程名和线程名,绑定到指定的 CPU 核心,并设置指定的调度优先级。此模块高度优化,进程扫描和动态规则应用开销极低。 161 | 162 | 识别上下文的任务调度器定义有如下场景: 163 | 164 | - `bg`:进程处于后台 165 | - `fg`:进程处于前台 166 | - `idle`:进程处于顶层可见,默认场景 167 | - `touch`:进程处于顶层可见,交互场景 168 | - `boost`:进程处于顶层可见,重负载场景 169 | 170 | | 字段 | 类型 | 描述 | 171 | | -------- | ------ | -------------------------- | 172 | | enable | bool | 启用识别上下文的任务调度器 | 173 | | cpumask | object | CPU 组定义 | 174 | | affinity | object | CPU 亲和性类别定义 | 175 | | prio | object | 调度优先级类别定义 | 176 | | rules | object | 进程规则 | 177 | 178 | #### cpumask/CPU 组定义 179 | 180 | 按键值对定义: 181 | 182 | - 键:CPU 组名称 183 | - 值:此 CPU 组包含的 CPU 核心 id 列表 184 | 185 | 例子: 186 | 187 | ```json 188 | "perf": [4, 5, 6, 7] 189 | ``` 190 | 191 | #### affinity/CPU 亲和性类别定义 192 | 193 | 按键值对定义: 194 | 195 | - 键:CPU 亲和性类别名称 196 | - 值:每个场景绑定到的`cpumask` 197 | 198 | 例子: 199 | 200 | ```json 201 | "coop": { 202 | "bg": "eff", 203 | "fg": "eff", 204 | "idle": "norm", 205 | "touch": "norm", 206 | "boost": "norm" 207 | } 208 | ``` 209 | 210 | #### prio/调度优先级类别定义 211 | 212 | 按键值对定义: 213 | 214 | - 键:调度优先级类别名称 215 | - 值:每个场景应用的调度优先级,值定义如下 216 | 217 | | 数值 | 描述 | 218 | | ------- | ------------------------------------------------------ | 219 | | 0 | 跳过 SCHED 类别设置 | 220 | | 1~98 | 设置线程调度类别为`SCHED_FIFO`,数值为实时静态优先级 | 221 | | 100~139 | 设置线程调度类别为`SCHED_NORMAL`,数值为实时静态优先级 | 222 | | -1 | 设置线程调度类别为`SCHED_NORMAL` | 223 | | -2 | 设置线程调度类别为`SCHED_BATCH` | 224 | | -3 | 设置线程调度类别为`SCHED_IDLE` | 225 | 226 | 例子: 227 | 228 | ```json 229 | "high": { 230 | "bg": -3, 231 | "fg": 110, 232 | "idle": 104, 233 | "touch": 102, 234 | "boost": 100 235 | } 236 | ``` 237 | 238 | #### rules/进程规则 239 | 240 | 类型为对象列表,与匹配优先级顺序一致。 241 | 242 | 注:正则匹配规则`/HOME_PACKAGE/`在内部会自动替换为当前系统启动器的包名。 243 | 244 | | 字段 | 类型 | 描述 | 245 | | ------ | ------ | -------------------------------------------- | 246 | | name | string | 进程规则名 | 247 | | regex | string | 进程名正则匹配规则,注意不要与 json 语法冲突 | 248 | | pinned | bool | 始终作为`处于顶层可见的进程`应用规则 | 249 | | rules | object | 此进程的线程规则 | 250 | 251 | ##### rules/线程规则 252 | 253 | 类型为对象列表,与匹配优先级顺序一致。 254 | 255 | 注:正则匹配规则`/MAIN_THREAD/`在内部会自动替换为主线程线程名。 256 | 257 | | 字段 | 类型 | 描述 | 258 | | ---- | ------ | ----------------------------------------------------------------------- | 259 | | k | string | 线程名正则匹配规则,注意不要与 json 语法冲突(abbr: keyword) | 260 | | ac | string | 线程的 CPU 亲和性类别,需要在`affinity`预先定义(abbr: affinity class) | 261 | | pc | string | 线程的调度优先级类别,需要在`prio`预先定义(abbr: priority class) | 262 | 263 | ## initials/初始值 264 | 265 | 功能模块的动态参数段,模块初始化完成后可动态切换,用于调整阈值、模块行为倾向性等。在此段定义的值为该模块参数的默认值。 266 | 267 | ### cpu/用户态 CPU 调频 268 | 269 | 基于能耗模型的用户态 CPU 调频器工作流程如下,提供多个可调节参数: 270 | 271 | 1. 从内核周期性采样 CPU 每个核心的负载 272 | - CPU 整体存在一定负载时,以`baseSampleTime`周期采样 CPU 频率,提高响应速度 273 | - CPU 整体进入空载时,以`baseSlackTime`周期采样 CPU 频率,减少轮询开销 274 | 2. 计算每个集群的性能负载和性能需求 275 | - 如果 CPU 集群最大负载增加量大于`predictThd`,则性能需求计算使用预测的负载值 276 | - 根据性能负载计算性能需求,`demand = load + (1 - load) * (margin + burst)` 277 | - 与`margin`不同,`burst`非零时即使当前负载较低也能计算到较大的性能需求 278 | 3. 计算性能需求对应的工作频点 279 | - CPU 整体如果存在多个集群,它们共享整个`latencyTime`,表示从性能最低的集群的最低频到性能最高的集群的最高频率的最小延迟 280 | - 由于离散采样周期的存在,实测 CPU 整体升频最小延迟一般会大于设定的`latencyTime` 281 | - 能耗代价越大的频点,升频到它的延迟也越大,且低于`sweetFreq`的频点没有额外的升频延迟 282 | 4. 限制 CPU 整体的功耗 283 | - 类似于 Intel 处理器的 PL1 和 PL2 功耗限制,兼顾短期爆发性能需求和长期能效需求 284 | - 根据能耗模型和每个核心的负载,估计当前周期 CPU 整体的能耗值 285 | - 如果当前能耗大于`slowLimitPower`,能耗缓冲池余量减少 286 | - 如果当前能耗小于`slowLimitPower`,能耗缓冲池余量增加,并按照`fastLimitRecoverScale`缩放因子恢复,总量不超过`fastLimitCapacity` 287 | - 限制 CPU 功耗根据能耗模型选择最优频率限制,在限定功耗下提供最佳整体性能 288 | - `burst`非零时忽略`fastLimitPower`和`slowLimitPower`限制 289 | 5. 引导任务调度器放置任务 290 | - 启用`guideCap`后,根据能耗模型调节集群性能容量,引导 EAS 任务调度器把任务放置到能效最佳的集群 291 | - 启用`limitEfficiency`后,低性能集群最大频点能效值不高于高性能集群当前频点的能效值 292 | 6. 写入目标 CPU 频率到内核 293 | - 高效的 CPU 频率写入器,用户态 CPU 调频整体周期运行耗时大约为 0.0005 秒 294 | 295 | | 字段 | 类型 | 描述 | 296 | | --------------------- | ----- | -------------------------------------------------------------------------------------------- | 297 | | baseSampleTime | float | (单位:秒)(0.01~0.5)基础采样周期 | 298 | | baseSlackTime | float | (单位:秒)(0.01~0.5)闲置采样周期,CPU 整体进入空载时生效 | 299 | | latencyTime | float | (单位:秒)(0.0~10.0)CPU 整体升频最小延迟 | 300 | | slowLimitPower | float | (单位:瓦)(0.05~999.0)CPU 长期功耗限制 | 301 | | fastLimitPower | float | (单位:瓦)(0.05~999.0)CPU 短期功耗限制,能耗缓冲池消耗完毕后进入长期功耗限制 | 302 | | fastLimitCapacity | float | (单位:瓦秒)(0.0~999.0)CPU 短期功耗限制容量,增加时重置余量为限制容量 | 303 | | fastLimitRecoverScale | float | (0.1~10.0)CPU 短期功耗限制容量恢复缩放因子 | 304 | | predictThd | float | (0.1~1.0)CPU 集群最大负载增加量大于该阈值,则集群调频使用预测的负载值,并忽略`latencyTime` | 305 | | margin | float | (0.0~1.0)调频提供的性能余量 | 306 | | burst | float | (0.0~1.0)调频提供的额外性能余量,非零时忽略`latencyTime`和功耗限制 | 307 | | guideCap | bool | 启用引导 EAS 任务调度负载转移 | 308 | | limitEfficiency | bool | 启用 CPU 整体能效限制 | 309 | 310 | ### sysfs/内核节点写入器 311 | 312 | 按键值对定义: 313 | 314 | - 键:内核节点名称 315 | - 值:内核节点文件写入值,支持`string`和`int`类型 316 | 317 | 例子: 318 | 319 | ```json 320 | "cpusetTa": "0-7" 321 | ``` 322 | 323 | ### sched/识别上下文的任务调度器 324 | 325 | | 字段 | 类型 | 描述 | 326 | | ----- | ------ | -------------------------------------------------------- | 327 | | scene | string | 进程处于顶层可见的场景,合法值有`idle`, `touch`, `boost` | 328 | 329 | ## presets/参数预设 330 | 331 | 功能模块的参数预设段,在这里定义不同的性能模式,如均衡模式、节能模式。 332 | 333 | 每组参数预设必须包含`*`, `idle`, `touch`, `trigger`, `gesture`, `junk`, `switch`,如下样例所示。参数预设中子配置名称定义同[动态配置切换器](#switcher/动态配置切换器),在状态跳转后应用对应模式的动态参数。其中`*`中的参数为该组参数预设的动态参数默认值。 334 | 335 | ```json 336 | "balance": { 337 | "*": { 338 | }, 339 | "idle": { 340 | }, 341 | "touch": { 342 | }, 343 | "trigger": { 344 | }, 345 | "gesture": { 346 | }, 347 | "junk": { 348 | }, 349 | "switch": { 350 | } 351 | } 352 | ``` 353 | 354 | 为了提高参数预设的可读性,参数值采用`层叠样式表`的设计方式。以下示例展示参数值`cpu.baseSampleTime`的覆盖关系: 355 | 356 | 1. 在`/initial/cpu`中定义`baseSampleTime`全局默认值为`0.01` 357 | 2. 在`/presets/balance/*`中定义`baseSampleTime`在该参数预设默认值为`0.02`,覆盖全局默认值`0.01` 358 | 3. 在`/presets/balance/idle`中定义`baseSampleTime`在`idle`场景值为`0.04`,覆盖该参数预设默认值`0.02` 359 | 360 | ``` 361 | "initials": { 362 | "cpu": { 363 | "baseSampleTime": 0.01, 364 | } 365 | }, 366 | "presets": { 367 | "balance": { 368 | "*": { 369 | "cpu.baseSampleTime": 0.02 370 | }, 371 | "idle": { 372 | "cpu.baseSampleTime": 0.04 373 | } 374 | } 375 | } 376 | ``` 377 | -------------------------------------------------------------------------------- /config/perapp_powermode.txt: -------------------------------------------------------------------------------- 1 | # 分应用性能模式配置 2 | # Per-app dynamic power mode rule 3 | # '-' means offscreen rule 4 | # '*' means default rule 5 | 6 | com.tencent.tmgp.sgame performance 7 | com.miHoYo.Yuanshen performance 8 | com.tencent.tmgp.pubgmhd performance 9 | com.miHoYo.bh3.bilibili performance 10 | com.miHoYo.enterprise.NGHSoD performance 11 | com.miHoYo.ys.bilibili performance 12 | com.tencent.lolm performance 13 | com.netease.wotb performance 14 | com.tencent.tmgp.speedmobile performance 15 | com.tencent.KiHan performance 16 | fi.twomenandadog.zombiecatchers performance 17 | com.garena.game.kgtw performance 18 | com.tencent.ig performance 19 | com.supercell.brawlstars performance 20 | com.ioncannon.cpuburn.gpugflops fast 21 | com.primatelabs.geekbench5 fast 22 | - powersave 23 | * balance 24 | -------------------------------------------------------------------------------- /config/sdm665.json: -------------------------------------------------------------------------------- 1 | { 2 | "meta": { 3 | "name": "sdm665/sdm662[22.09.04]", 4 | "author": "yc@coolapk ❤️吟惋兮❤️改" 5 | }, 6 | "modules": { 7 | "switcher": { 8 | "switchInode": "/sdcard/Android/yc/uperf/cur_powermode.txt", 9 | "perapp": "/sdcard/Android/yc/uperf/perapp_powermode.txt", 10 | "hintDuration": { 11 | "idle": 0.0, 12 | "touch": 4.0, 13 | "trigger": 0.03, 14 | "gesture": 0.1, 15 | "switch": 0.4, 16 | "junk": 0.06 17 | } 18 | }, 19 | "atrace": { 20 | "enable": false 21 | }, 22 | "log": { 23 | "level": "info" 24 | }, 25 | "input": { 26 | "enable": true, 27 | "swipeThd": 0.03, 28 | "gestureThdX": 0.03, 29 | "gestureThdY": 0.03, 30 | "gestureDelayTime": 2.0, 31 | "holdEnterTime": 1.0 32 | }, 33 | "sfanalysis": { 34 | "enable": true, 35 | "renderIdleSlackTime": 0.2 36 | }, 37 | "cpu": { 38 | "enable": true, 39 | "powerModel": [ 40 | { 41 | "efficiency": 100, 42 | "nr": 4, 43 | "typicalPower": 0.36, 44 | "typicalFreq": 1.8, 45 | "sweetFreq": 1.4, 46 | "plainFreq": 1.0, 47 | "freeFreq": 0.6 48 | }, 49 | { 50 | "efficiency": 170, 51 | "nr": 4, 52 | "typicalPower": 1.5, 53 | "typicalFreq": 2.2, 54 | "sweetFreq": 1.8, 55 | "plainFreq": 1.1, 56 | "freeFreq": 1.1 57 | } 58 | ] 59 | }, 60 | "sysfs": { 61 | "enable": true, 62 | "knob": { 63 | "cpusetTa": "/dev/cpuset/top-app/cpus", 64 | "cpusetFg": "/dev/cpuset/foreground/cpus", 65 | "cpusetBg": "/dev/cpuset/background/cpus", 66 | "cpusetSysBg": "/dev/cpuset/system-background/cpus", 67 | "cpusetRe": "/dev/cpuset/restricted/cpus" 68 | } 69 | }, 70 | "sched": { 71 | "enable": true, 72 | "cpumask": { 73 | "all": [ 74 | 0, 75 | 1, 76 | 2, 77 | 3, 78 | 4, 79 | 5, 80 | 6, 81 | 7 82 | ], 83 | "c0": [ 84 | 0, 85 | 1, 86 | 2, 87 | 3 88 | ], 89 | "c1": [ 90 | 4, 91 | 5, 92 | 6 93 | ], 94 | "c2": [ 95 | 7 96 | ] 97 | }, 98 | "affinity": { 99 | "auto": { 100 | "bg": "", 101 | "fg": "", 102 | "idle": "", 103 | "touch": "", 104 | "boost": "" 105 | }, 106 | "norm": { 107 | "bg": "", 108 | "fg": "all", 109 | "idle": "all", 110 | "touch": "all", 111 | "boost": "all" 112 | }, 113 | "bg": { 114 | "bg": "", 115 | "fg": "c0", 116 | "idle": "c0", 117 | "touch": "c0", 118 | "boost": "c0" 119 | }, 120 | "ui": { 121 | "bg": "", 122 | "fg": "all", 123 | "idle": "all", 124 | "touch": "c1", 125 | "boost": "all" 126 | }, 127 | "crit": { 128 | "bg": "", 129 | "fg": "all", 130 | "idle": "all", 131 | "touch": "c1", 132 | "boost": "c1" 133 | }, 134 | "gtcoop": { 135 | "bg": "", 136 | "fg": "all", 137 | "idle": "all", 138 | "touch": "c1", 139 | "boost": "all" 140 | }, 141 | "gtmain": { 142 | "bg": "", 143 | "fg": "all", 144 | "idle": "all", 145 | "touch": "c2", 146 | "boost": "all" 147 | } 148 | }, 149 | "prio": { 150 | "auto": { 151 | "bg": 0, 152 | "fg": 0, 153 | "idle": 0, 154 | "touch": 0, 155 | "boost": 0 156 | }, 157 | "bg": { 158 | "bg": -3, 159 | "fg": 139, 160 | "idle": 139, 161 | "touch": 139, 162 | "boost": 139 163 | }, 164 | "norm": { 165 | "bg": -1, 166 | "fg": -1, 167 | "idle": 120, 168 | "touch": 120, 169 | "boost": 130 170 | }, 171 | "coop": { 172 | "bg": -3, 173 | "fg": 124, 174 | "idle": 122, 175 | "touch": 122, 176 | "boost": 130 177 | }, 178 | "ui": { 179 | "bg": -3, 180 | "fg": 120, 181 | "idle": 110, 182 | "touch": 98, 183 | "boost": 116 184 | }, 185 | "rtusr": { 186 | "bg": 98, 187 | "fg": 98, 188 | "idle": 97, 189 | "touch": 97, 190 | "boost": 98 191 | }, 192 | "rtsys": { 193 | "bg": 97, 194 | "fg": 97, 195 | "idle": 96, 196 | "touch": 96, 197 | "boost": 97 198 | } 199 | }, 200 | "rules": [ 201 | { 202 | "name": "Launcher", 203 | "regex": "/HOME_PACKAGE/", 204 | "pinned": true, 205 | "rules": [ 206 | { 207 | "k": "/MAIN_THREAD/", 208 | "ac": "crit", 209 | "pc": "rtusr" 210 | }, 211 | { 212 | "k": "^(RenderThread|GLThread)", 213 | "ac": "crit", 214 | "pc": "rtusr" 215 | }, 216 | { 217 | "k": "^(GPU completion|HWC release|hwui|FramePolicy|ScrollPolicy|ged-swd)", 218 | "ac": "bg", 219 | "pc": "rtusr" 220 | }, 221 | { 222 | "k": ".", 223 | "ac": "auto", 224 | "pc": "auto" 225 | } 226 | ] 227 | }, 228 | { 229 | "name": "SurfaceFlinger", 230 | "regex": "/system/bin/surfaceflinger", 231 | "pinned": true, 232 | "rules": [ 233 | { 234 | "k": "/MAIN_THREAD/", 235 | "ac": "crit", 236 | "pc": "auto" 237 | }, 238 | { 239 | "k": "^(app|RenderEngine)", 240 | "ac": "crit", 241 | "pc": "auto" 242 | }, 243 | { 244 | "k": "^Binder:", 245 | "ac": "auto", 246 | "pc": "auto" 247 | }, 248 | { 249 | "k": ".", 250 | "ac": "bg", 251 | "pc": "auto" 252 | } 253 | ] 254 | }, 255 | { 256 | "name": "SystemServer", 257 | "regex": "system_server", 258 | "pinned": true, 259 | "rules": [ 260 | { 261 | "k": "^(TaskSnapshot|Greezer|CachedApp|SystemPressure|SensorService)|[Mm]emory", 262 | "ac": "bg", 263 | "pc": "auto" 264 | }, 265 | { 266 | "k": "^Async", 267 | "ac": "auto", 268 | "pc": "norm" 269 | }, 270 | { 271 | "k": ".", 272 | "ac": "auto", 273 | "pc": "auto" 274 | } 275 | ] 276 | }, 277 | { 278 | "name": "SystemUI", 279 | "regex": "com.android.systemui", 280 | "pinned": true, 281 | "rules": [ 282 | { 283 | "k": "^(Jit thread pool|HeapTaskDaemon|FinalizerDaemon|ReferenceQueueD)", 284 | "ac": "bg", 285 | "pc": "auto" 286 | }, 287 | { 288 | "k": ".", 289 | "ac": "auto", 290 | "pc": "auto" 291 | } 292 | ] 293 | }, 294 | { 295 | "name": "MediaProvider", 296 | "regex": "^com.android.providers.media", 297 | "pinned": true, 298 | "rules": [ 299 | { 300 | "k": ".", 301 | "ac": "auto", 302 | "pc": "bg" 303 | } 304 | ] 305 | }, 306 | { 307 | "name": "Memory reclaim", 308 | "regex": "swapd|compactd", 309 | "pinned": true, 310 | "rules": [ 311 | { 312 | "k": ".", 313 | "ac": "auto", 314 | "pc": "bg" 315 | } 316 | ] 317 | }, 318 | { 319 | "name": "Phone", 320 | "regex": "com.android.phone", 321 | "pinned": false, 322 | "rules": [ 323 | { 324 | "k": ".", 325 | "ac": "auto", 326 | "pc": "auto" 327 | } 328 | ] 329 | }, 330 | { 331 | "name": "Other system processes", 332 | "regex": "^(/system|/vendor|magiskd|zygiskd)|@|-service$", 333 | "pinned": false, 334 | "rules": [ 335 | { 336 | "k": ".", 337 | "ac": "auto", 338 | "pc": "auto" 339 | } 340 | ] 341 | }, 342 | { 343 | "name": "App co-process", 344 | "regex": "[.].+:", 345 | "pinned": false, 346 | "rules": [ 347 | { 348 | "k": "^(Jit thread pool|HeapTaskDaemon|FinalizerDaemon|ReferenceQueueD)", 349 | "ac": "bg", 350 | "pc": "auto" 351 | } 352 | ] 353 | }, 354 | { 355 | "name": "Default rule", 356 | "regex": ".", 357 | "pinned": false, 358 | "rules": [ 359 | { 360 | "k": "/MAIN_THREAD/", 361 | "ac": "ui", 362 | "pc": "ui" 363 | }, 364 | { 365 | "k": "^(UnityMain|RenderThread |GameThread)", 366 | "ac": "gtmain", 367 | "pc": "auto" 368 | }, 369 | { 370 | "k": "^(Unity|Worker Thread|TaskGraph|RHIThread|GLThread|Thread-|Job.Worker)", 371 | "ac": "gtcoop", 372 | "pc": "auto" 373 | }, 374 | { 375 | "k": "^(RenderThread|JNISurfaceText|IJK_External_Re)|[Aa]nim|([.]raster|[.]ui)$", 376 | "ac": "ui", 377 | "pc": "ui" 378 | }, 379 | { 380 | "k": "^(Chrome_InProc|CrRendererMain|CrGpuMain|CompositorTile)", 381 | "ac": "norm", 382 | "pc": "auto" 383 | }, 384 | { 385 | "k": "^(Viz|Chrome_|Compositor)|[Vv]sync|mali-", 386 | "ac": "ui", 387 | "pc": "ui" 388 | }, 389 | { 390 | "k": "^(OkHttp|Ysa|Xqa|Rx|APM|TVKDL-|tp-|cgi-|ODCP-|Bugly|xlog_)", 391 | "ac": "bg", 392 | "pc": "auto" 393 | }, 394 | { 395 | "k": "^(xg_vip_service|Profile|SearchDaemon|default_matrix|FrameDecoder|FrameSeq)", 396 | "ac": "bg", 397 | "pc": "auto" 398 | }, 399 | { 400 | "k": "^(GPU completion|HWC release|hwui|FramePolicy|ScrollPolicy|ged-swd)", 401 | "ac": "bg", 402 | "pc": "rtusr" 403 | }, 404 | { 405 | "k": "^(JS|libweexjsb|WeexJsBridge|mqt_native|mqt_js|JavaScriptTh)", 406 | "ac": "norm", 407 | "pc": "coop" 408 | }, 409 | { 410 | "k": "^(pool-|glide-|launcher-|Fresco)|[Dd]ownload|[Ss]chedule|[Ww]ork|[Pp]ool|[Dd]efau", 411 | "ac": "norm", 412 | "pc": "coop" 413 | }, 414 | { 415 | "k": ".", 416 | "ac": "norm", 417 | "pc": "auto" 418 | } 419 | ] 420 | } 421 | ] 422 | } 423 | }, 424 | "initials": { 425 | "cpu": { 426 | "baseSampleTime": 0.01, 427 | "baseSlackTime": 0.01, 428 | "latencyTime": 0.5, 429 | "slowLimitPower": 3.0, 430 | "fastLimitPower": 6.0, 431 | "fastLimitCapacity": 10.0, 432 | "fastLimitRecoverScale": 0.3, 433 | "predictThd": 0.3, 434 | "margin": 0.2, 435 | "burst": 0.0, 436 | "guideCap": true, 437 | "limitEfficiency": false 438 | }, 439 | "sysfs": { 440 | "cpusetTa": "0-7", 441 | "cpusetFg": "0-2,4-7", 442 | "cpusetBg": "0-2", 443 | "cpusetSysBg": "0-2", 444 | "cpusetRe": "0-6" 445 | }, 446 | "sched": { 447 | "scene": "idle" 448 | } 449 | }, 450 | "presets": { 451 | "balance": { 452 | "*": { 453 | "cpu.latencyTime": 0.2, 454 | "cpu.slowLimitPower": 2.0, 455 | "cpu.fastLimitPower": 2.0, 456 | "cpu.fastLimitCapacity": 16.0, 457 | "cpu.margin": 0.2 458 | }, 459 | "idle": { 460 | "cpu.baseSampleTime": 0.04, 461 | "cpu.baseSlackTime": 0.08, 462 | "cpu.predictThd": 0.3, 463 | "cpu.limitEfficiency": true, 464 | "sched.scene": "idle" 465 | }, 466 | "touch": { 467 | "cpu.baseSampleTime": 0.04, 468 | "sched.scene": "touch" 469 | }, 470 | "trigger": { 471 | "cpu.latencyTime": 0.0, 472 | "cpu.margin": 0.4, 473 | "sched.scene": "touch" 474 | }, 475 | "gesture": { 476 | "cpu.margin": 0.6, 477 | "sched.scene": "touch" 478 | }, 479 | "junk": { 480 | "cpu.burst": 0.7, 481 | "sched.scene": "touch" 482 | }, 483 | "switch": { 484 | "cpu.latencyTime": 0.0, 485 | "cpu.slowLimitPower": 3.0, 486 | "cpu.fastLimitPower": 5.0, 487 | "cpu.fastLimitRecoverScale": 0.1, 488 | "cpu.margin": 0.4, 489 | "sched.scene": "boost" 490 | } 491 | }, 492 | "powersave": { 493 | "*": { 494 | "cpu.latencyTime": 0.4, 495 | "cpu.slowLimitPower": 1.0, 496 | "cpu.fastLimitPower": 1.0, 497 | "cpu.fastLimitCapacity": 1.0, 498 | "cpu.margin": 0.08 499 | }, 500 | "idle": { 501 | "cpu.baseSampleTime": 0.04, 502 | "cpu.baseSlackTime": 0.08, 503 | "cpu.predictThd": 1.0, 504 | "cpu.limitEfficiency": true, 505 | "sched.scene": "idle" 506 | }, 507 | "touch": { 508 | "cpu.baseSampleTime": 0.04, 509 | "sched.scene": "touch" 510 | }, 511 | "trigger": { 512 | "cpu.latencyTime": 0.0, 513 | "cpu.margin": 0.2, 514 | "sched.scene": "touch" 515 | }, 516 | "gesture": { 517 | "cpu.margin": 0.2, 518 | "sched.scene": "touch" 519 | }, 520 | "junk": { 521 | "cpu.burst": 0.2, 522 | "sched.scene": "touch" 523 | }, 524 | "switch": { 525 | "cpu.latencyTime": 0.0, 526 | "cpu.slowLimitPower": 1.5, 527 | "cpu.fastLimitPower": 2.0, 528 | "cpu.fastLimitRecoverScale": 0.1, 529 | "cpu.margin": 0.3, 530 | "sched.scene": "boost" 531 | } 532 | }, 533 | "performance": { 534 | "*": { 535 | "cpu.latencyTime": 0.0, 536 | "cpu.slowLimitPower": 999.0, 537 | "cpu.fastLimitPower": 999.0, 538 | "cpu.fastLimitCapacity": 999.0, 539 | "cpu.margin": 0.5, 540 | "cpu.burst": 0.43 541 | }, 542 | "idle": { 543 | "sched.scene": "idle" 544 | }, 545 | "touch": { 546 | "sched.scene": "touch" 547 | }, 548 | "trigger": { 549 | "cpu.margin": 0.5, 550 | "sched.scene": "touch" 551 | }, 552 | "gesture": { 553 | "cpu.margin": 0.6, 554 | "sched.scene": "touch" 555 | }, 556 | "junk": { 557 | "cpu.burst": 0.6, 558 | "sched.scene": "touch" 559 | }, 560 | "switch": { 561 | "sched.scene": "boost" 562 | } 563 | }, 564 | "fast": { 565 | "*": { 566 | "cpu.latencyTime": 0.0, 567 | "cpu.slowLimitPower": 999.0, 568 | "cpu.fastLimitPower": 999.0, 569 | "cpu.fastLimitCapacity": 999.0, 570 | "cpu.burst": 1.0 571 | }, 572 | "idle": { 573 | "sched.scene": "idle" 574 | }, 575 | "touch": { 576 | "sched.scene": "touch" 577 | }, 578 | "trigger": { 579 | "sched.scene": "touch" 580 | }, 581 | "gesture": { 582 | "sched.scene": "touch" 583 | }, 584 | "junk": { 585 | "sched.scene": "touch" 586 | }, 587 | "switch": { 588 | "sched.scene": "boost" 589 | } 590 | } 591 | } 592 | } -------------------------------------------------------------------------------- /config/sdm750.json: -------------------------------------------------------------------------------- 1 | { 2 | "meta": { 3 | "name": "sdm750/sdm750g[22.09.04]", 4 | "author": "yc@coolapk ❤️吟惋兮❤改️" 5 | }, 6 | "modules": { 7 | "switcher": { 8 | "switchInode": "/sdcard/Android/yc/uperf/cur_powermode.txt", 9 | "perapp": "/sdcard/Android/yc/uperf/perapp_powermode.txt", 10 | "hintDuration": { 11 | "idle": 0.0, 12 | "touch": 4.0, 13 | "trigger": 0.03, 14 | "gesture": 0.1, 15 | "switch": 0.4, 16 | "junk": 0.06 17 | } 18 | }, 19 | "atrace": { 20 | "enable": false 21 | }, 22 | "log": { 23 | "level": "info" 24 | }, 25 | "input": { 26 | "enable": true, 27 | "swipeThd": 0.03, 28 | "gestureThdX": 0.03, 29 | "gestureThdY": 0.03, 30 | "gestureDelayTime": 2.0, 31 | "holdEnterTime": 1.0 32 | }, 33 | "sfanalysis": { 34 | "enable": true, 35 | "renderIdleSlackTime": 0.2 36 | }, 37 | "cpu": { 38 | "enable": true, 39 | "powerModel": [ 40 | { 41 | "efficiency": 115, 42 | "nr": 6, 43 | "typicalPower": 0.4, 44 | "typicalFreq": 1.8, 45 | "sweetFreq": 1.4, 46 | "plainFreq": 1.2, 47 | "freeFreq": 0.6 48 | }, 49 | { 50 | "efficiency": 300, 51 | "nr": 2, 52 | "typicalPower": 1.6, 53 | "typicalFreq": 2.2, 54 | "sweetFreq": 1.6, 55 | "plainFreq": 1.0, 56 | "freeFreq": 0.7 57 | } 58 | ] 59 | }, 60 | "sysfs": { 61 | "enable": true, 62 | "knob": { 63 | "cpusetTa": "/dev/cpuset/top-app/cpus", 64 | "cpusetFg": "/dev/cpuset/foreground/cpus", 65 | "cpusetBg": "/dev/cpuset/background/cpus", 66 | "cpusetSysBg": "/dev/cpuset/system-background/cpus", 67 | "cpusetRe": "/dev/cpuset/restricted/cpus" 68 | } 69 | }, 70 | "sched": { 71 | "enable": true, 72 | "cpumask": { 73 | "all": [ 74 | 0, 75 | 1, 76 | 2, 77 | 3, 78 | 4, 79 | 5, 80 | 6, 81 | 7 82 | ], 83 | "c0": [ 84 | 0, 85 | 1, 86 | 2, 87 | 3, 88 | 4, 89 | 5 90 | ], 91 | "c1": [ 92 | 6, 93 | 7 94 | ], 95 | "c2": [ 96 | 6, 97 | 7 98 | ] 99 | }, 100 | "affinity": { 101 | "auto": { 102 | "bg": "", 103 | "fg": "", 104 | "idle": "", 105 | "touch": "", 106 | "boost": "" 107 | }, 108 | "norm": { 109 | "bg": "", 110 | "fg": "all", 111 | "idle": "all", 112 | "touch": "all", 113 | "boost": "all" 114 | }, 115 | "bg": { 116 | "bg": "", 117 | "fg": "c0", 118 | "idle": "c0", 119 | "touch": "c0", 120 | "boost": "c0" 121 | }, 122 | "ui": { 123 | "bg": "", 124 | "fg": "all", 125 | "idle": "all", 126 | "touch": "c1", 127 | "boost": "all" 128 | }, 129 | "crit": { 130 | "bg": "", 131 | "fg": "all", 132 | "idle": "all", 133 | "touch": "c1", 134 | "boost": "c1" 135 | }, 136 | "gtcoop": { 137 | "bg": "", 138 | "fg": "all", 139 | "idle": "all", 140 | "touch": "c1", 141 | "boost": "all" 142 | }, 143 | "gtmain": { 144 | "bg": "", 145 | "fg": "all", 146 | "idle": "all", 147 | "touch": "c2", 148 | "boost": "all" 149 | } 150 | }, 151 | "prio": { 152 | "auto": { 153 | "bg": 0, 154 | "fg": 0, 155 | "idle": 0, 156 | "touch": 0, 157 | "boost": 0 158 | }, 159 | "bg": { 160 | "bg": -3, 161 | "fg": 139, 162 | "idle": 139, 163 | "touch": 139, 164 | "boost": 139 165 | }, 166 | "norm": { 167 | "bg": -1, 168 | "fg": -1, 169 | "idle": 120, 170 | "touch": 120, 171 | "boost": 130 172 | }, 173 | "coop": { 174 | "bg": -3, 175 | "fg": 124, 176 | "idle": 122, 177 | "touch": 122, 178 | "boost": 130 179 | }, 180 | "ui": { 181 | "bg": -3, 182 | "fg": 120, 183 | "idle": 110, 184 | "touch": 98, 185 | "boost": 116 186 | }, 187 | "rtusr": { 188 | "bg": 98, 189 | "fg": 98, 190 | "idle": 97, 191 | "touch": 97, 192 | "boost": 98 193 | }, 194 | "rtsys": { 195 | "bg": 97, 196 | "fg": 97, 197 | "idle": 96, 198 | "touch": 96, 199 | "boost": 97 200 | } 201 | }, 202 | "rules": [ 203 | { 204 | "name": "Launcher", 205 | "regex": "/HOME_PACKAGE/", 206 | "pinned": true, 207 | "rules": [ 208 | { 209 | "k": "/MAIN_THREAD/", 210 | "ac": "crit", 211 | "pc": "rtusr" 212 | }, 213 | { 214 | "k": "^(RenderThread|GLThread)", 215 | "ac": "crit", 216 | "pc": "rtusr" 217 | }, 218 | { 219 | "k": "^(GPU completion|HWC release|hwui|FramePolicy|ScrollPolicy|ged-swd)", 220 | "ac": "bg", 221 | "pc": "rtusr" 222 | }, 223 | { 224 | "k": ".", 225 | "ac": "auto", 226 | "pc": "auto" 227 | } 228 | ] 229 | }, 230 | { 231 | "name": "SurfaceFlinger", 232 | "regex": "/system/bin/surfaceflinger", 233 | "pinned": true, 234 | "rules": [ 235 | { 236 | "k": "/MAIN_THREAD/", 237 | "ac": "crit", 238 | "pc": "auto" 239 | }, 240 | { 241 | "k": "^(app|RenderEngine)", 242 | "ac": "crit", 243 | "pc": "auto" 244 | }, 245 | { 246 | "k": "^Binder:", 247 | "ac": "auto", 248 | "pc": "auto" 249 | }, 250 | { 251 | "k": ".", 252 | "ac": "bg", 253 | "pc": "auto" 254 | } 255 | ] 256 | }, 257 | { 258 | "name": "SystemServer", 259 | "regex": "system_server", 260 | "pinned": true, 261 | "rules": [ 262 | { 263 | "k": "^(TaskSnapshot|Greezer|CachedApp|SystemPressure|SensorService)|[Mm]emory", 264 | "ac": "bg", 265 | "pc": "auto" 266 | }, 267 | { 268 | "k": "^Async", 269 | "ac": "auto", 270 | "pc": "norm" 271 | }, 272 | { 273 | "k": ".", 274 | "ac": "auto", 275 | "pc": "auto" 276 | } 277 | ] 278 | }, 279 | { 280 | "name": "SystemUI", 281 | "regex": "com.android.systemui", 282 | "pinned": true, 283 | "rules": [ 284 | { 285 | "k": "^(Jit thread pool|HeapTaskDaemon|FinalizerDaemon|ReferenceQueueD)", 286 | "ac": "bg", 287 | "pc": "auto" 288 | }, 289 | { 290 | "k": ".", 291 | "ac": "auto", 292 | "pc": "auto" 293 | } 294 | ] 295 | }, 296 | { 297 | "name": "MediaProvider", 298 | "regex": "^com.android.providers.media", 299 | "pinned": true, 300 | "rules": [ 301 | { 302 | "k": ".", 303 | "ac": "auto", 304 | "pc": "bg" 305 | } 306 | ] 307 | }, 308 | { 309 | "name": "Memory reclaim", 310 | "regex": "swapd|compactd", 311 | "pinned": true, 312 | "rules": [ 313 | { 314 | "k": ".", 315 | "ac": "auto", 316 | "pc": "bg" 317 | } 318 | ] 319 | }, 320 | { 321 | "name": "Phone", 322 | "regex": "com.android.phone", 323 | "pinned": false, 324 | "rules": [ 325 | { 326 | "k": ".", 327 | "ac": "auto", 328 | "pc": "auto" 329 | } 330 | ] 331 | }, 332 | { 333 | "name": "Other system processes", 334 | "regex": "^(/system|/vendor|magiskd|zygiskd)|@|-service$", 335 | "pinned": false, 336 | "rules": [ 337 | { 338 | "k": ".", 339 | "ac": "auto", 340 | "pc": "auto" 341 | } 342 | ] 343 | }, 344 | { 345 | "name": "App co-process", 346 | "regex": "[.].+:", 347 | "pinned": false, 348 | "rules": [ 349 | { 350 | "k": "^(Jit thread pool|HeapTaskDaemon|FinalizerDaemon|ReferenceQueueD)", 351 | "ac": "bg", 352 | "pc": "auto" 353 | } 354 | ] 355 | }, 356 | { 357 | "name": "Default rule", 358 | "regex": ".", 359 | "pinned": false, 360 | "rules": [ 361 | { 362 | "k": "/MAIN_THREAD/", 363 | "ac": "ui", 364 | "pc": "ui" 365 | }, 366 | { 367 | "k": "^(UnityMain|RenderThread |GameThread)", 368 | "ac": "gtmain", 369 | "pc": "auto" 370 | }, 371 | { 372 | "k": "^(Unity|Worker Thread|TaskGraph|RHIThread|GLThread|Thread-|Job.Worker)", 373 | "ac": "gtcoop", 374 | "pc": "auto" 375 | }, 376 | { 377 | "k": "^(RenderThread|JNISurfaceText|IJK_External_Re)|[Aa]nim|([.]raster|[.]ui)$", 378 | "ac": "ui", 379 | "pc": "ui" 380 | }, 381 | { 382 | "k": "^(Chrome_InProc|CrRendererMain|CrGpuMain|CompositorTile)", 383 | "ac": "norm", 384 | "pc": "auto" 385 | }, 386 | { 387 | "k": "^(Viz|Chrome_|Compositor)|[Vv]sync|mali-", 388 | "ac": "ui", 389 | "pc": "ui" 390 | }, 391 | { 392 | "k": "^(OkHttp|Ysa|Xqa|Rx|APM|TVKDL-|tp-|cgi-|ODCP-|Bugly|xlog_)", 393 | "ac": "bg", 394 | "pc": "auto" 395 | }, 396 | { 397 | "k": "^(xg_vip_service|Profile|SearchDaemon|default_matrix|FrameDecoder|FrameSeq)", 398 | "ac": "bg", 399 | "pc": "auto" 400 | }, 401 | { 402 | "k": "^(GPU completion|HWC release|hwui|FramePolicy|ScrollPolicy|ged-swd)", 403 | "ac": "bg", 404 | "pc": "rtusr" 405 | }, 406 | { 407 | "k": "^(JS|libweexjsb|WeexJsBridge|mqt_native|mqt_js|JavaScriptTh)", 408 | "ac": "norm", 409 | "pc": "coop" 410 | }, 411 | { 412 | "k": "^(pool-|glide-|launcher-|Fresco)|[Dd]ownload|[Ss]chedule|[Ww]ork|[Pp]ool|[Dd]efau", 413 | "ac": "norm", 414 | "pc": "coop" 415 | }, 416 | { 417 | "k": ".", 418 | "ac": "norm", 419 | "pc": "auto" 420 | } 421 | ] 422 | } 423 | ] 424 | } 425 | }, 426 | "initials": { 427 | "cpu": { 428 | "baseSampleTime": 0.01, 429 | "baseSlackTime": 0.01, 430 | "latencyTime": 0.5, 431 | "slowLimitPower": 3.0, 432 | "fastLimitPower": 6.0, 433 | "fastLimitCapacity": 10.0, 434 | "fastLimitRecoverScale": 0.3, 435 | "predictThd": 0.3, 436 | "margin": 0.2, 437 | "burst": 0.0, 438 | "guideCap": true, 439 | "limitEfficiency": false 440 | }, 441 | "sysfs": { 442 | "cpusetTa": "0-7", 443 | "cpusetFg": "0-3,6-7", 444 | "cpusetBg": "0-3", 445 | "cpusetSysBg": "0-3", 446 | "cpusetRe": "0-3,6-7" 447 | }, 448 | "sched": { 449 | "scene": "idle" 450 | } 451 | }, 452 | "presets": { 453 | "balance": { 454 | "*": { 455 | "cpu.latencyTime": 0.2, 456 | "cpu.slowLimitPower": 2.0, 457 | "cpu.fastLimitPower": 2.0, 458 | "cpu.fastLimitCapacity": 16.0, 459 | "cpu.margin": 0.2 460 | }, 461 | "idle": { 462 | "cpu.baseSampleTime": 0.04, 463 | "cpu.baseSlackTime": 0.08, 464 | "cpu.predictThd": 0.3, 465 | "cpu.limitEfficiency": true, 466 | "sched.scene": "idle" 467 | }, 468 | "touch": { 469 | "cpu.baseSampleTime": 0.04, 470 | "sched.scene": "touch" 471 | }, 472 | "trigger": { 473 | "cpu.latencyTime": 0.0, 474 | "cpu.margin": 0.4, 475 | "sched.scene": "touch" 476 | }, 477 | "gesture": { 478 | "cpu.margin": 0.6, 479 | "sched.scene": "touch" 480 | }, 481 | "junk": { 482 | "cpu.burst": 0.7, 483 | "sched.scene": "touch" 484 | }, 485 | "switch": { 486 | "cpu.latencyTime": 0.0, 487 | "cpu.slowLimitPower": 3.0, 488 | "cpu.fastLimitPower": 5.0, 489 | "cpu.fastLimitRecoverScale": 0.1, 490 | "cpu.margin": 0.4, 491 | "sched.scene": "boost" 492 | } 493 | }, 494 | "powersave": { 495 | "*": { 496 | "cpu.latencyTime": 0.4, 497 | "cpu.slowLimitPower": 1.0, 498 | "cpu.fastLimitPower": 1.0, 499 | "cpu.fastLimitCapacity": 4.0, 500 | "cpu.margin": 0.1 501 | }, 502 | "idle": { 503 | "cpu.baseSampleTime": 0.04, 504 | "cpu.baseSlackTime": 0.08, 505 | "cpu.predictThd": 1.0, 506 | "cpu.limitEfficiency": true, 507 | "sched.scene": "idle" 508 | }, 509 | "touch": { 510 | "cpu.baseSampleTime": 0.04, 511 | "sched.scene": "touch" 512 | }, 513 | "trigger": { 514 | "cpu.latencyTime": 0.0, 515 | "cpu.margin": 0.1, 516 | "sched.scene": "touch" 517 | }, 518 | "gesture": { 519 | "cpu.margin": 0.2, 520 | "sched.scene": "touch" 521 | }, 522 | "junk": { 523 | "cpu.burst": 0.1, 524 | "sched.scene": "touch" 525 | }, 526 | "switch": { 527 | "cpu.latencyTime": 0.0, 528 | "cpu.slowLimitPower": 1.5, 529 | "cpu.fastLimitPower": 2.5, 530 | "cpu.fastLimitRecoverScale": 0.1, 531 | "cpu.margin": 0.3, 532 | "sched.scene": "boost" 533 | } 534 | }, 535 | "performance": { 536 | "*": { 537 | "cpu.latencyTime": 0.0, 538 | "cpu.slowLimitPower": 999.0, 539 | "cpu.fastLimitPower": 999.0, 540 | "cpu.fastLimitCapacity": 999.0, 541 | "cpu.margin": 0.4, 542 | "cpu.burst": 0.55 543 | }, 544 | "idle": { 545 | "sched.scene": "idle" 546 | }, 547 | "touch": { 548 | "sched.scene": "touch" 549 | }, 550 | "trigger": { 551 | "sched.scene": "touch" 552 | }, 553 | "gesture": { 554 | "sched.scene": "touch" 555 | }, 556 | "junk": { 557 | "cpu.burst": 0.6, 558 | "sched.scene": "touch" 559 | }, 560 | "switch": { 561 | "sched.scene": "boost" 562 | } 563 | }, 564 | "fast": { 565 | "*": { 566 | "cpu.latencyTime": 0.0, 567 | "cpu.slowLimitPower": 999.0, 568 | "cpu.fastLimitPower": 999.0, 569 | "cpu.fastLimitCapacity": 999.0, 570 | "cpu.margin": 1.0 571 | }, 572 | "idle": { 573 | "sched.scene": "idle" 574 | }, 575 | "touch": { 576 | "sched.scene": "touch" 577 | }, 578 | "trigger": { 579 | "sched.scene": "touch" 580 | }, 581 | "gesture": { 582 | "sched.scene": "touch" 583 | }, 584 | "junk": { 585 | "sched.scene": "touch" 586 | }, 587 | "switch": { 588 | "sched.scene": "boost" 589 | } 590 | } 591 | } 592 | } -------------------------------------------------------------------------------- /config/template.json: -------------------------------------------------------------------------------- 1 | { 2 | "meta": { 3 | "name": "platform[yy.mm.dd]", 4 | "author": "author@community" 5 | }, 6 | "modules": { 7 | "switcher": { 8 | "switchInode": "/sdcard/Android/yc/uperf/cur_powermode.txt", 9 | "perapp": "/sdcard/Android/yc/uperf/perapp_powermode.txt", 10 | "hintDuration": { 11 | "idle": 0.0, 12 | "touch": 4.0, 13 | "trigger": 0.03, 14 | "gesture": 0.1, 15 | "switch": 0.4, 16 | "junk": 0.06 17 | } 18 | }, 19 | "atrace": { 20 | "enable": false 21 | }, 22 | "log": { 23 | "level": "info" 24 | }, 25 | "input": { 26 | "enable": true, 27 | "swipeThd": 0.03, 28 | "gestureThdX": 0.03, 29 | "gestureThdY": 0.03, 30 | "gestureDelayTime": 2.0, 31 | "holdEnterTime": 1.0 32 | }, 33 | "sfanalysis": { 34 | "enable": true, 35 | "renderIdleSlackTime": 0.2 36 | }, 37 | "cpu": { 38 | "enable": true, 39 | "powerModel": [] 40 | }, 41 | "sysfs": { 42 | "enable": true, 43 | "knob": { 44 | "cpusetTa": "/dev/cpuset/top-app/cpus", 45 | "cpusetFg": "/dev/cpuset/foreground/cpus", 46 | "cpusetBg": "/dev/cpuset/background/cpus", 47 | "cpusetSysBg": "/dev/cpuset/system-background/cpus", 48 | "cpusetRe": "/dev/cpuset/restricted/cpus" 49 | } 50 | }, 51 | "sched": { 52 | "enable": true, 53 | "cpumask": { 54 | "all": [0, 1, 2, 3, 4, 5, 6, 7], 55 | "c0": [0, 1, 2, 3], 56 | "c1": [4, 5, 6], 57 | "c2": [7] 58 | }, 59 | "affinity": { 60 | "auto": { "bg": "", "fg": "", "idle": "", "touch": "", "boost": "" }, 61 | "norm": { "bg": "", "fg": "all", "idle": "all", "touch": "all", "boost": "all" }, 62 | "bg": { "bg": "", "fg": "c0", "idle": "c0", "touch": "c0", "boost": "c0" }, 63 | "ui": { "bg": "", "fg": "all", "idle": "all", "touch": "c1", "boost": "all" }, 64 | "crit": { "bg": "", "fg": "all", "idle": "all", "touch": "c1", "boost": "c1" }, 65 | "gtcoop": { "bg": "", "fg": "all", "idle": "all", "touch": "c1", "boost": "all" }, 66 | "gtmain": { "bg": "", "fg": "all", "idle": "all", "touch": "c2", "boost": "all" } 67 | }, 68 | "prio": { 69 | "auto": { "bg": 0, "fg": 0, "idle": 0, "touch": 0, "boost": 0 }, 70 | "bg": { "bg": -3, "fg": 139, "idle": 139, "touch": 139, "boost": 139 }, 71 | "norm": { "bg": -1, "fg": -1, "idle": 120, "touch": 120, "boost": 130 }, 72 | "coop": { "bg": -3, "fg": 124, "idle": 122, "touch": 122, "boost": 130 }, 73 | "ui": { "bg": -3, "fg": 120, "idle": 110, "touch": 98, "boost": 116 }, 74 | "rtusr": { "bg": 98, "fg": 98, "idle": 97, "touch": 97, "boost": 98 }, 75 | "rtsys": { "bg": 97, "fg": 97, "idle": 96, "touch": 96, "boost": 97 } 76 | }, 77 | "rules": [ 78 | { 79 | "name": "Launcher", 80 | "regex": "/HOME_PACKAGE/", 81 | "pinned": true, 82 | "rules": [ 83 | { "k": "/MAIN_THREAD/", "ac": "crit", "pc": "rtusr" }, 84 | { "k": "^(RenderThread|GLThread)", "ac": "crit", "pc": "rtusr" }, 85 | { "k": "^(GPU completion|HWC release|hwui|FramePolicy|ScrollPolicy|ged-swd)", "ac": "bg", "pc": "rtusr" }, 86 | { "k": ".", "ac": "auto", "pc": "auto" } 87 | ] 88 | }, 89 | { 90 | "name": "SurfaceFlinger", 91 | "regex": "/system/bin/surfaceflinger", 92 | "pinned": true, 93 | "rules": [ 94 | { "k": "/MAIN_THREAD/", "ac": "crit", "pc": "auto" }, 95 | { "k": "^(app|RenderEngine)", "ac": "crit", "pc": "auto" }, 96 | { "k": "^Binder:", "ac": "auto", "pc": "auto" }, 97 | { "k": ".", "ac": "bg", "pc": "auto" } 98 | ] 99 | }, 100 | { 101 | "name": "SystemServer", 102 | "regex": "system_server", 103 | "pinned": true, 104 | "rules": [ 105 | { "k": "^(TaskSnapshot|Greezer|CachedApp|SystemPressure|SensorService)|[Mm]emory", "ac": "bg", "pc": "auto" }, 106 | { "k": "^Async", "ac": "auto", "pc": "norm" }, 107 | { "k": ".", "ac": "auto", "pc": "auto" } 108 | ] 109 | }, 110 | { 111 | "name": "SystemUI", 112 | "regex": "com.android.systemui", 113 | "pinned": true, 114 | "rules": [ 115 | { "k": "^(Jit thread pool|HeapTaskDaemon|FinalizerDaemon|ReferenceQueueD)", "ac": "bg", "pc": "auto" }, 116 | { "k": ".", "ac": "auto", "pc": "auto" } 117 | ] 118 | }, 119 | { 120 | "name": "MediaProvider", 121 | "regex": "^com.android.providers.media", 122 | "pinned": true, 123 | "rules": [{ "k": ".", "ac": "auto", "pc": "bg" }] 124 | }, 125 | { 126 | "name": "Memory reclaim", 127 | "regex": "swapd|compactd", 128 | "pinned": true, 129 | "rules": [{ "k": ".", "ac": "auto", "pc": "bg" }] 130 | }, 131 | { 132 | "name": "Phone", 133 | "regex": "com.android.phone", 134 | "pinned": false, 135 | "rules": [{ "k": ".", "ac": "auto", "pc": "auto" }] 136 | }, 137 | { 138 | "name": "Other system processes", 139 | "regex": "^(/system|/vendor|magiskd|zygiskd)|@|-service$", 140 | "pinned": false, 141 | "rules": [{ "k": ".", "ac": "auto", "pc": "auto" }] 142 | }, 143 | { 144 | "name": "App co-process", 145 | "regex": "[.].+:", 146 | "pinned": false, 147 | "rules": [{ "k": "^(Jit thread pool|HeapTaskDaemon|FinalizerDaemon|ReferenceQueueD)", "ac": "bg", "pc": "auto" }] 148 | }, 149 | { 150 | "name": "Default rule", 151 | "regex": ".", 152 | "pinned": false, 153 | "rules": [ 154 | { "k": "/MAIN_THREAD/", "ac": "ui", "pc": "ui" }, 155 | { "k": "^(UnityMain|RenderThread |GameThread)", "ac": "gtmain", "pc": "auto" }, 156 | { "k": "^(Unity|Worker Thread|TaskGraph|RHIThread|GLThread|Thread-|Job.Worker)", "ac": "gtcoop", "pc": "auto" }, 157 | { "k": "^(RenderThread|JNISurfaceText|IJK_External_Re)|[Aa]nim|([.]raster|[.]ui)$", "ac": "ui", "pc": "ui" }, 158 | { "k": "^(Chrome_InProc|CrRendererMain|CrGpuMain|CompositorTile)", "ac": "norm", "pc": "auto" }, 159 | { "k": "^(Viz|Chrome_|Compositor)|[Vv]sync|mali-", "ac": "ui", "pc": "ui" }, 160 | { "k": "^(OkHttp|Ysa|Xqa|Rx|APM|TVKDL-|tp-|cgi-|ODCP-|Bugly|xlog_)", "ac": "bg", "pc": "auto" }, 161 | { "k": "^(xg_vip_service|Profile|SearchDaemon|default_matrix|FrameDecoder|FrameSeq)", "ac": "bg", "pc": "auto" }, 162 | { "k": "^(GPU completion|HWC release|hwui|FramePolicy|ScrollPolicy|ged-swd)", "ac": "bg", "pc": "rtusr" }, 163 | { "k": "^(JS|libweexjsb|WeexJsBridge|mqt_native|mqt_js|JavaScriptTh)", "ac": "norm", "pc": "coop" }, 164 | { "k": "^(pool-|glide-|launcher-|Fresco)|[Dd]ownload|[Ss]chedule|[Ww]ork|[Pp]ool|[Dd]efau", "ac": "norm", "pc": "coop" }, 165 | { "k": ".", "ac": "norm", "pc": "auto" } 166 | ] 167 | } 168 | ] 169 | } 170 | }, 171 | "initials": { 172 | "cpu": { 173 | "baseSampleTime": 0.01, 174 | "baseSlackTime": 0.01, 175 | "latencyTime": 0.5, 176 | "slowLimitPower": 3.0, 177 | "fastLimitPower": 6.0, 178 | "fastLimitCapacity": 10.0, 179 | "fastLimitRecoverScale": 0.3, 180 | "predictThd": 0.3, 181 | "margin": 0.25, 182 | "burst": 0.0, 183 | "guideCap": true, 184 | "limitEfficiency": false 185 | }, 186 | "sysfs": { 187 | "cpusetTa": "0-7", 188 | "cpusetFg": "0-2,4-7", 189 | "cpusetBg": "0-2", 190 | "cpusetSysBg": "0-2", 191 | "cpusetRe": "0-6" 192 | }, 193 | "sched": { 194 | "scene": "idle" 195 | } 196 | }, 197 | "presets": { 198 | "balance": { 199 | "*": { 200 | "cpu.latencyTime": 0.2, 201 | "cpu.slowLimitPower": 2.0, 202 | "cpu.fastLimitPower": 2.0, 203 | "cpu.fastLimitCapacity": 16.0, 204 | "cpu.margin": 0.2 205 | }, 206 | "idle": { 207 | "cpu.baseSampleTime": 0.04, 208 | "cpu.baseSlackTime": 0.08, 209 | "cpu.predictThd": 0.3, 210 | "cpu.limitEfficiency": true, 211 | "sched.scene": "idle" 212 | }, 213 | "touch": { 214 | "cpu.baseSampleTime": 0.04, 215 | "sched.scene": "touch" 216 | }, 217 | "trigger": { 218 | "cpu.latencyTime": 0.0, 219 | "cpu.margin": 0.4, 220 | "sched.scene": "touch" 221 | }, 222 | "gesture": { 223 | "cpu.margin": 0.6, 224 | "sched.scene": "touch" 225 | }, 226 | "junk": { 227 | "cpu.burst": 0.6, 228 | "sched.scene": "touch" 229 | }, 230 | "switch": { 231 | "cpu.latencyTime": 0.0, 232 | "cpu.slowLimitPower": 3.0, 233 | "cpu.fastLimitPower": 5.0, 234 | "cpu.fastLimitRecoverScale": 0.1, 235 | "cpu.margin": 0.4, 236 | "sched.scene": "boost" 237 | } 238 | }, 239 | "powersave": { 240 | "*": { 241 | "cpu.latencyTime": 0.4, 242 | "cpu.slowLimitPower": 1.0, 243 | "cpu.fastLimitPower": 1.0, 244 | "cpu.fastLimitCapacity": 4.0, 245 | "cpu.margin": 0.1 246 | }, 247 | "idle": { 248 | "cpu.baseSampleTime": 0.04, 249 | "cpu.baseSlackTime": 0.08, 250 | "cpu.predictThd": 1.0, 251 | "cpu.limitEfficiency": true, 252 | "sched.scene": "idle" 253 | }, 254 | "touch": { 255 | "cpu.baseSampleTime": 0.04, 256 | "sched.scene": "touch" 257 | }, 258 | "trigger": { 259 | "cpu.latencyTime": 0.0, 260 | "cpu.margin": 0.3, 261 | "sched.scene": "touch" 262 | }, 263 | "gesture": { 264 | "cpu.margin": 0.6, 265 | "sched.scene": "touch" 266 | }, 267 | "junk": { 268 | "cpu.burst": 0.3, 269 | "sched.scene": "touch" 270 | }, 271 | "switch": { 272 | "cpu.latencyTime": 0.0, 273 | "cpu.slowLimitPower": 1.5, 274 | "cpu.fastLimitPower": 2.5, 275 | "cpu.fastLimitRecoverScale": 0.1, 276 | "cpu.margin": 0.3, 277 | "sched.scene": "boost" 278 | } 279 | }, 280 | "performance": { 281 | "*": { 282 | "cpu.latencyTime": 0.0, 283 | "cpu.slowLimitPower": 4.0, 284 | "cpu.fastLimitPower": 10.0, 285 | "cpu.fastLimitCapacity": 360.0, 286 | "cpu.margin": 0.4 287 | }, 288 | "idle": { 289 | "cpu.baseSampleTime": 0.01, 290 | "cpu.baseSlackTime": 0.04, 291 | "sched.scene": "idle" 292 | }, 293 | "touch": { 294 | "sched.scene": "touch" 295 | }, 296 | "trigger": { 297 | "cpu.margin": 0.8, 298 | "sched.scene": "touch" 299 | }, 300 | "gesture": { 301 | "cpu.margin": 0.8, 302 | "sched.scene": "touch" 303 | }, 304 | "junk": { 305 | "cpu.burst": 0.5, 306 | "sched.scene": "touch" 307 | }, 308 | "switch": { 309 | "cpu.burst": 0.2, 310 | "sched.scene": "boost" 311 | } 312 | }, 313 | "fast": { 314 | "*": { 315 | "cpu.latencyTime": 0.0, 316 | "cpu.slowLimitPower": 2.5, 317 | "cpu.fastLimitPower": 2.5, 318 | "cpu.fastLimitCapacity": 0.0, 319 | "cpu.margin": 0.4 320 | }, 321 | "idle": { 322 | "cpu.baseSampleTime": 0.01, 323 | "cpu.baseSlackTime": 0.04, 324 | "sched.scene": "idle" 325 | }, 326 | "touch": { 327 | "sched.scene": "touch" 328 | }, 329 | "trigger": { 330 | "cpu.margin": 0.8, 331 | "sched.scene": "touch" 332 | }, 333 | "gesture": { 334 | "cpu.margin": 0.8, 335 | "sched.scene": "touch" 336 | }, 337 | "junk": { 338 | "cpu.burst": 0.5, 339 | "sched.scene": "touch" 340 | }, 341 | "switch": { 342 | "cpu.burst": 0.2, 343 | "sched.scene": "boost" 344 | } 345 | } 346 | } 347 | } 348 | -------------------------------------------------------------------------------- /magisk/META-INF/com/google/android/update-binary: -------------------------------------------------------------------------------- 1 | #!/sbin/sh 2 | 3 | ################# 4 | # Initialization 5 | ################# 6 | 7 | umask 022 8 | 9 | # echo before loading util_functions 10 | ui_print() { echo "$1"; } 11 | 12 | require_new_magisk() { 13 | ui_print "*******************************" 14 | ui_print " Please install Magisk v20.4+! " 15 | ui_print "*******************************" 16 | exit 1 17 | } 18 | 19 | ######################### 20 | # Load util_functions.sh 21 | ######################### 22 | 23 | OUTFD=$2 24 | ZIPFILE=$3 25 | 26 | mount /data 2>/dev/null 27 | 28 | [ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk 29 | . /data/adb/magisk/util_functions.sh 30 | [ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk 31 | 32 | install_module 33 | exit 0 34 | -------------------------------------------------------------------------------- /magisk/META-INF/com/google/android/updater-script: -------------------------------------------------------------------------------- 1 | #MAGISK 2 | -------------------------------------------------------------------------------- /magisk/bin/busybox/busybox: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinwanxi/Uperf-Game-Turbo/298d3d6bd272102105fc837fa92ffed9ee10dd20/magisk/bin/busybox/busybox -------------------------------------------------------------------------------- /magisk/bin/uperf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinwanxi/Uperf-Game-Turbo/298d3d6bd272102105fc837fa92ffed9ee10dd20/magisk/bin/uperf -------------------------------------------------------------------------------- /magisk/config/perapp_powermode.txt: -------------------------------------------------------------------------------- 1 | # 分应用性能模式配置 2 | # Per-app dynamic power mode rule 3 | # '-' means offscreen rule 4 | # '*' means default rule 5 | 6 | com.tencent.tmgp.sgame performance 7 | com.miHoYo.Yuanshen performance 8 | com.tencent.tmgp.pubgmhd performance 9 | com.miHoYo.bh3.bilibili performance 10 | com.miHoYo.enterprise.NGHSoD performance 11 | com.miHoYo.ys.bilibili performance 12 | com.tencent.lolm performance 13 | com.netease.wotb performance 14 | com.tencent.tmgp.speedmobile performance 15 | com.tencent.KiHan performance 16 | fi.twomenandadog.zombiecatchers performance 17 | com.garena.game.kgtw performance 18 | com.tencent.ig performance 19 | com.supercell.brawlstars performance 20 | com.ioncannon.cpuburn.gpugflops fast 21 | com.primatelabs.geekbench5 fast 22 | - powersave 23 | * performance 24 | -------------------------------------------------------------------------------- /magisk/config/sdm210.json: -------------------------------------------------------------------------------- 1 | { 2 | "meta": { 3 | "name": "sdm210", 4 | "author": "yc@coolapk ❤️吟惋兮❤" 5 | }, 6 | "modules": { 7 | "switcher": { 8 | "switchInode": "/sdcard/Android/yc/uperf/cur_powermode.txt", 9 | "perapp": "/sdcard/Android/yc/uperf/perapp_powermode.txt", 10 | "hintDuration": { 11 | "idle": 0.0, 12 | "touch": 4.0, 13 | "trigger": 0.03, 14 | "gesture": 0.1, 15 | "switch": 0.4, 16 | "junk": 0.06 17 | } 18 | }, 19 | "atrace": { 20 | "enable": false 21 | }, 22 | "log": { 23 | "level": "info" 24 | }, 25 | "input": { 26 | "enable": true, 27 | "swipeThd": 0.03, 28 | "gestureThdX": 0.03, 29 | "gestureThdY": 0.03, 30 | "gestureDelayTime": 2.0, 31 | "holdEnterTime": 1.0 32 | }, 33 | "sfanalysis": { 34 | "enable": true, 35 | "renderIdleSlackTime": 0.2 36 | }, 37 | "cpu": { 38 | "enable": true, 39 | "powerModel": [ 40 | { 41 | "efficiency": 100, 42 | "nr": 4, 43 | "typicalPower": 1.2, 44 | "typicalFreq": 1.1, 45 | "sweetFreq": 0.8, 46 | "plainFreq": 0.6, 47 | "freeFreq": 0.4 48 | } 49 | }, 50 | "sysfs": { 51 | "enable": true, 52 | "knob": { 53 | "llccddrMin0": "/sys/class/devfreq/soc:qcom,cpu0-llcc-ddr-lat/min_freq", 54 | "llccddrMin4": "/sys/class/devfreq/soc:qcom,cpu4-llcc-ddr-lat/min_freq", 55 | "llccddrRC0": "/sys/class/devfreq/soc:qcom,cpu0-llcc-ddr-lat/mem_latency/ratio_ceil", 56 | "llccddrRC4": "/sys/class/devfreq/soc:qcom,cpu4-llcc-ddr-lat/mem_latency/ratio_ceil", 57 | "cpusetTa": "/dev/cpuset/top-app/cpus", 58 | "cpusetFg": "/dev/cpuset/foreground/cpus", 59 | "cpusetBg": "/dev/cpuset/background/cpus", 60 | "cpusetSysBg": "/dev/cpuset/system-background/cpus", 61 | "cpusetRe": "/dev/cpuset/restricted/cpus" 62 | } 63 | }, 64 | "sched": { 65 | "enable": true, 66 | "cpumask": { 67 | "all": [ 68 | 0, 69 | 1, 70 | 2, 71 | 3 72 | ], 73 | "c0": [ 74 | 0, 75 | 1 76 | ], 77 | "c1": [ 78 | 2, 79 | 3 80 | ], 81 | "c2": [ 82 | 2, 83 | 3 84 | ] 85 | }, 86 | "affinity": { 87 | "auto": { 88 | "bg": "", 89 | "fg": "", 90 | "idle": "", 91 | "touch": "", 92 | "boost": "" 93 | }, 94 | "norm": { 95 | "bg": "", 96 | "fg": "all", 97 | "idle": "all", 98 | "touch": "all", 99 | "boost": "all" 100 | }, 101 | "bg": { 102 | "bg": "", 103 | "fg": "c0", 104 | "idle": "c0", 105 | "touch": "c0", 106 | "boost": "c0" 107 | }, 108 | "ui": { 109 | "bg": "", 110 | "fg": "all", 111 | "idle": "all", 112 | "touch": "c1", 113 | "boost": "all" 114 | }, 115 | "crit": { 116 | "bg": "", 117 | "fg": "all", 118 | "idle": "all", 119 | "touch": "c1", 120 | "boost": "c1" 121 | }, 122 | "gtcoop": { 123 | "bg": "", 124 | "fg": "all", 125 | "idle": "all", 126 | "touch": "c1", 127 | "boost": "all" 128 | }, 129 | "gtmain": { 130 | "bg": "", 131 | "fg": "all", 132 | "idle": "all", 133 | "touch": "c2", 134 | "boost": "all" 135 | } 136 | }, 137 | "prio": { 138 | "auto": { 139 | "bg": 0, 140 | "fg": 0, 141 | "idle": 0, 142 | "touch": 0, 143 | "boost": 0 144 | }, 145 | "bg": { 146 | "bg": -3, 147 | "fg": 139, 148 | "idle": 139, 149 | "touch": 139, 150 | "boost": 139 151 | }, 152 | "norm": { 153 | "bg": -1, 154 | "fg": -1, 155 | "idle": 120, 156 | "touch": 120, 157 | "boost": 130 158 | }, 159 | "coop": { 160 | "bg": -3, 161 | "fg": 124, 162 | "idle": 122, 163 | "touch": 122, 164 | "boost": 130 165 | }, 166 | "ui": { 167 | "bg": -3, 168 | "fg": 120, 169 | "idle": 110, 170 | "touch": 98, 171 | "boost": 116 172 | }, 173 | "rtusr": { 174 | "bg": 98, 175 | "fg": 98, 176 | "idle": 97, 177 | "touch": 97, 178 | "boost": 98 179 | }, 180 | "rtsys": { 181 | "bg": 97, 182 | "fg": 97, 183 | "idle": 96, 184 | "touch": 96, 185 | "boost": 97 186 | } 187 | }, 188 | "rules": [ 189 | { 190 | "name": "Launcher", 191 | "regex": "/HOME_PACKAGE/", 192 | "pinned": true, 193 | "rules": [ 194 | { 195 | "k": "/MAIN_THREAD/", 196 | "ac": "crit", 197 | "pc": "rtusr" 198 | }, 199 | { 200 | "k": "^(RenderThread|GLThread)", 201 | "ac": "crit", 202 | "pc": "rtusr" 203 | }, 204 | { 205 | "k": "^(GPU completion|HWC release|hwui|FramePolicy|ScrollPolicy|ged-swd)", 206 | "ac": "bg", 207 | "pc": "rtusr" 208 | }, 209 | { 210 | "k": ".", 211 | "ac": "auto", 212 | "pc": "auto" 213 | } 214 | ] 215 | }, 216 | { 217 | "name": "SurfaceFlinger", 218 | "regex": "/system/bin/surfaceflinger", 219 | "pinned": true, 220 | "rules": [ 221 | { 222 | "k": "/MAIN_THREAD/", 223 | "ac": "crit", 224 | "pc": "auto" 225 | }, 226 | { 227 | "k": "^(app|RenderEngine)", 228 | "ac": "crit", 229 | "pc": "auto" 230 | }, 231 | { 232 | "k": "^Binder:", 233 | "ac": "auto", 234 | "pc": "auto" 235 | }, 236 | { 237 | "k": ".", 238 | "ac": "bg", 239 | "pc": "auto" 240 | } 241 | ] 242 | }, 243 | { 244 | "name": "SystemServer", 245 | "regex": "system_server", 246 | "pinned": true, 247 | "rules": [ 248 | { 249 | "k": "^(TaskSnapshot|Greezer|CachedApp|SystemPressure|SensorService)|[Mm]emory", 250 | "ac": "bg", 251 | "pc": "auto" 252 | }, 253 | { 254 | "k": "^Async", 255 | "ac": "auto", 256 | "pc": "norm" 257 | }, 258 | { 259 | "k": ".", 260 | "ac": "auto", 261 | "pc": "auto" 262 | } 263 | ] 264 | }, 265 | { 266 | "name": "SystemUI", 267 | "regex": "com.android.systemui", 268 | "pinned": true, 269 | "rules": [ 270 | { 271 | "k": "^(Jit thread pool|HeapTaskDaemon|FinalizerDaemon|ReferenceQueueD)", 272 | "ac": "bg", 273 | "pc": "auto" 274 | }, 275 | { 276 | "k": ".", 277 | "ac": "auto", 278 | "pc": "auto" 279 | } 280 | ] 281 | }, 282 | { 283 | "name": "MediaProvider", 284 | "regex": "^com.android.providers.media", 285 | "pinned": true, 286 | "rules": [ 287 | { 288 | "k": ".", 289 | "ac": "auto", 290 | "pc": "bg" 291 | } 292 | ] 293 | }, 294 | { 295 | "name": "Memory reclaim", 296 | "regex": "swapd|compactd", 297 | "pinned": true, 298 | "rules": [ 299 | { 300 | "k": ".", 301 | "ac": "auto", 302 | "pc": "bg" 303 | } 304 | ] 305 | }, 306 | { 307 | "name": "Phone", 308 | "regex": "com.android.phone", 309 | "pinned": false, 310 | "rules": [ 311 | { 312 | "k": ".", 313 | "ac": "auto", 314 | "pc": "auto" 315 | } 316 | ] 317 | }, 318 | { 319 | "name": "Other system processes", 320 | "regex": "^(/system|/vendor|magiskd|zygiskd)|@|-service$", 321 | "pinned": false, 322 | "rules": [ 323 | { 324 | "k": ".", 325 | "ac": "auto", 326 | "pc": "auto" 327 | } 328 | ] 329 | }, 330 | { 331 | "name": "App co-process", 332 | "regex": "[.].+:", 333 | "pinned": false, 334 | "rules": [ 335 | { 336 | "k": "^(Jit thread pool|HeapTaskDaemon|FinalizerDaemon|ReferenceQueueD)", 337 | "ac": "bg", 338 | "pc": "auto" 339 | } 340 | ] 341 | }, 342 | { 343 | "name": "Default rule", 344 | "regex": ".", 345 | "pinned": false, 346 | "rules": [ 347 | { 348 | "k": "/MAIN_THREAD/", 349 | "ac": "ui", 350 | "pc": "ui" 351 | }, 352 | { 353 | "k": "^(UnityMain|RenderThread |GameThread)", 354 | "ac": "gtmain", 355 | "pc": "auto" 356 | }, 357 | { 358 | "k": "^(Unity|Worker Thread|TaskGraph|RHIThread|GLThread|Thread-|Job.Worker)", 359 | "ac": "gtcoop", 360 | "pc": "auto" 361 | }, 362 | { 363 | "k": "^(RenderThread|JNISurfaceText|IJK_External_Re)|[Aa]nim|([.]raster|[.]ui)$", 364 | "ac": "ui", 365 | "pc": "ui" 366 | }, 367 | { 368 | "k": "^(Chrome_InProc|CrRendererMain|CrGpuMain|CompositorTile)", 369 | "ac": "norm", 370 | "pc": "auto" 371 | }, 372 | { 373 | "k": "^(Viz|Chrome_|Compositor)|[Vv]sync|mali-", 374 | "ac": "ui", 375 | "pc": "ui" 376 | }, 377 | { 378 | "k": "^(OkHttp|Ysa|Xqa|Rx|APM|TVKDL-|tp-|cgi-|ODCP-|Bugly|xlog_)", 379 | "ac": "bg", 380 | "pc": "auto" 381 | }, 382 | { 383 | "k": "^(xg_vip_service|Profile|SearchDaemon|default_matrix|FrameDecoder|FrameSeq)", 384 | "ac": "bg", 385 | "pc": "auto" 386 | }, 387 | { 388 | "k": "^(GPU completion|HWC release|hwui|FramePolicy|ScrollPolicy|ged-swd)", 389 | "ac": "bg", 390 | "pc": "rtusr" 391 | }, 392 | { 393 | "k": "^(JS|libweexjsb|WeexJsBridge|mqt_native|mqt_js|JavaScriptTh)", 394 | "ac": "norm", 395 | "pc": "coop" 396 | }, 397 | { 398 | "k": "^(pool-|glide-|launcher-|Fresco)|[Dd]ownload|[Ss]chedule|[Ww]ork|[Pp]ool|[Dd]efau", 399 | "ac": "norm", 400 | "pc": "coop" 401 | }, 402 | { 403 | "k": ".", 404 | "ac": "norm", 405 | "pc": "auto" 406 | } 407 | ] 408 | } 409 | ] 410 | } 411 | }, 412 | "initials": { 413 | "cpu": { 414 | "baseSampleTime": 0.01, 415 | "baseSlackTime": 0.01, 416 | "latencyTime": 0.5, 417 | "slowLimitPower": 3.0, 418 | "fastLimitPower": 6.0, 419 | "fastLimitCapacity": 10.0, 420 | "fastLimitRecoverScale": 0.3, 421 | "predictThd": 0.3, 422 | "margin": 0.25, 423 | "burst": 0.0, 424 | "guideCap": true, 425 | "limitEfficiency": false 426 | }, 427 | "sysfs": { 428 | "llccddrMin0": "762", 429 | "llccddrMin4": "762", 430 | "llccddrRC0": "400", 431 | "llccddrRC4": "400", 432 | "cpusetTa": "0-3", 433 | "cpusetFg": "0-2", 434 | "cpusetBg": "0-1", 435 | "cpusetSysBg": "0", 436 | "cpusetRe": "0-3" 437 | }, 438 | "sched": { 439 | "scene": "idle" 440 | } 441 | }, 442 | "presets": { 443 | "fast": { 444 | "*": { 445 | "sysfs.llccddrMin0": "1100", 446 | "sysfs.llccddrMin4": "2500", 447 | "sysfs.llccddrRC0": "450", 448 | "sysfs.llccddrRC4": "650", 449 | "cpu.latencyTime": 0.0, 450 | "cpu.slowLimitPower": 999.0, 451 | "cpu.fastLimitPower": 999.0, 452 | "cpu.fastLimitCapacity": 999.0, 453 | "cpu.margin": 1, 454 | 455 | "cpu.burst": 1.0 456 | }, 457 | "idle": { 458 | "sched.scene": "touch" 459 | }, 460 | "touch": { 461 | "sched.scene": "touch" 462 | }, 463 | "trigger": { 464 | "sched.scene": "touch" 465 | }, 466 | "gesture": { 467 | "sched.scene": "touch" 468 | }, 469 | "junk": { 470 | "sched.scene": "touch" 471 | }, 472 | "switch": { 473 | "sched.scene": "boost" 474 | } 475 | }, 476 | "powersave": { 477 | "*": { 478 | "cpu.latencyTime": 0.4, 479 | "cpu.slowLimitPower": 1.0, 480 | "cpu.fastLimitPower": 1.0, 481 | "cpu.fastLimitCapacity": 4.0, 482 | "cpu.margin": 0.09 483 | }, 484 | "idle": { 485 | "cpu.baseSampleTime": 0.04, 486 | "cpu.baseSlackTime": 0.08, 487 | "cpu.predictThd": 1.0, 488 | "cpu.limitEfficiency": true, 489 | "sched.scene": "idle" 490 | }, 491 | "touch": { 492 | "cpu.baseSampleTime": 0.04, 493 | "sched.scene": "touch" 494 | }, 495 | "trigger": { 496 | "cpu.latencyTime": 0.0, 497 | "cpu.margin": 0.28, 498 | "sched.scene": "touch" 499 | }, 500 | "gesture": { 501 | "cpu.margin": 0.58, 502 | "sched.scene": "touch" 503 | }, 504 | "junk": { 505 | "cpu.burst": 0.28, 506 | "sched.scene": "touch" 507 | }, 508 | "switch": { 509 | "cpu.latencyTime": 0.0, 510 | "cpu.slowLimitPower": 1.5, 511 | "cpu.fastLimitPower": 2.5, 512 | "cpu.fastLimitRecoverScale": 0.1, 513 | "cpu.margin": 0.28, 514 | "sched.scene": "boost" 515 | } 516 | }, 517 | "performance": { 518 | "*": { 519 | "sysfs.llccddrMin0": "1100", 520 | "sysfs.llccddrMin4": "2500", 521 | "sysfs.llccddrRC0": "450", 522 | "sysfs.llccddrRC4": "650", 523 | "cpu.latencyTime": 0.0, 524 | "cpu.slowLimitPower": 999.0, 525 | "cpu.fastLimitPower": 999.0, 526 | "cpu.fastLimitCapacity": 999.0, 527 | "cpu.margin": 1, 528 | 529 | "cpu.burst": 1.0 530 | }, 531 | "idle": { 532 | "sched.scene": "touch" 533 | }, 534 | "touch": { 535 | "sched.scene": "touch" 536 | }, 537 | "trigger": { 538 | "sched.scene": "touch" 539 | }, 540 | "gesture": { 541 | "sched.scene": "touch" 542 | }, 543 | "junk": { 544 | "sched.scene": "touch" 545 | }, 546 | "switch": { 547 | "sched.scene": "boost" 548 | } 549 | }, 550 | "balance": { 551 | "*": { 552 | "sysfs.llccddrMin0": "1100", 553 | "sysfs.llccddrMin4": "2500", 554 | "sysfs.llccddrRC0": "450", 555 | "sysfs.llccddrRC4": "650", 556 | "cpu.latencyTime": 0.0, 557 | "cpu.slowLimitPower": 999.0, 558 | "cpu.fastLimitPower": 999.0, 559 | "cpu.fastLimitCapacity": 999.0, 560 | "cpu.burst": 1.0 561 | }, 562 | "idle": { 563 | "sched.scene": "touch" 564 | }, 565 | "touch": { 566 | "sched.scene": "touch" 567 | }, 568 | "trigger": { 569 | "sched.scene": "touch" 570 | }, 571 | "gesture": { 572 | "sched.scene": "touch" 573 | }, 574 | "junk": { 575 | "sched.scene": "touch" 576 | }, 577 | "switch": { 578 | "sched.scene": "boost" 579 | } 580 | } 581 | } 582 | } -------------------------------------------------------------------------------- /magisk/config/sdm750.json: -------------------------------------------------------------------------------- 1 | { 2 | "meta": { 3 | "name": "sdm750/sdm750g[22.09.04]", 4 | "author": "yc@coolapk ❤️吟惋兮❤改️" 5 | }, 6 | "modules": { 7 | "switcher": { 8 | "switchInode": "/sdcard/Android/yc/uperf/cur_powermode.txt", 9 | "perapp": "/sdcard/Android/yc/uperf/perapp_powermode.txt", 10 | "hintDuration": { 11 | "idle": 0.0, 12 | "touch": 4.0, 13 | "trigger": 0.03, 14 | "gesture": 0.1, 15 | "switch": 0.4, 16 | "junk": 0.06 17 | } 18 | }, 19 | "atrace": { 20 | "enable": false 21 | }, 22 | "log": { 23 | "level": "info" 24 | }, 25 | "input": { 26 | "enable": true, 27 | "swipeThd": 0.03, 28 | "gestureThdX": 0.03, 29 | "gestureThdY": 0.03, 30 | "gestureDelayTime": 2.0, 31 | "holdEnterTime": 1.0 32 | }, 33 | "sfanalysis": { 34 | "enable": true, 35 | "renderIdleSlackTime": 0.2 36 | }, 37 | "cpu": { 38 | "enable": true, 39 | "powerModel": [ 40 | { 41 | "efficiency": 115, 42 | "nr": 6, 43 | "typicalPower": 0.4, 44 | "typicalFreq": 1.8, 45 | "sweetFreq": 1.4, 46 | "plainFreq": 1.2, 47 | "freeFreq": 0.6 48 | }, 49 | { 50 | "efficiency": 300, 51 | "nr": 2, 52 | "typicalPower": 1.6, 53 | "typicalFreq": 2.2, 54 | "sweetFreq": 1.6, 55 | "plainFreq": 1.0, 56 | "freeFreq": 0.7 57 | } 58 | ] 59 | }, 60 | "sysfs": { 61 | "enable": true, 62 | "knob": { 63 | "cpusetTa": "/dev/cpuset/top-app/cpus", 64 | "cpusetFg": "/dev/cpuset/foreground/cpus", 65 | "cpusetBg": "/dev/cpuset/background/cpus", 66 | "cpusetSysBg": "/dev/cpuset/system-background/cpus", 67 | "cpusetRe": "/dev/cpuset/restricted/cpus" 68 | } 69 | }, 70 | "sched": { 71 | "enable": true, 72 | "cpumask": { 73 | "all": [ 74 | 0, 75 | 1, 76 | 2, 77 | 3, 78 | 4, 79 | 5, 80 | 6, 81 | 7 82 | ], 83 | "c0": [ 84 | 0, 85 | 1, 86 | 2, 87 | 3, 88 | 4, 89 | 5 90 | ], 91 | "c1": [ 92 | 6, 93 | 7 94 | ], 95 | "c2": [ 96 | 6, 97 | 7 98 | ] 99 | }, 100 | "affinity": { 101 | "auto": { 102 | "bg": "", 103 | "fg": "", 104 | "idle": "", 105 | "touch": "", 106 | "boost": "" 107 | }, 108 | "norm": { 109 | "bg": "", 110 | "fg": "all", 111 | "idle": "all", 112 | "touch": "all", 113 | "boost": "all" 114 | }, 115 | "bg": { 116 | "bg": "", 117 | "fg": "c0", 118 | "idle": "c0", 119 | "touch": "c0", 120 | "boost": "c0" 121 | }, 122 | "ui": { 123 | "bg": "", 124 | "fg": "all", 125 | "idle": "all", 126 | "touch": "c1", 127 | "boost": "all" 128 | }, 129 | "crit": { 130 | "bg": "", 131 | "fg": "all", 132 | "idle": "all", 133 | "touch": "c1", 134 | "boost": "c1" 135 | }, 136 | "gtcoop": { 137 | "bg": "", 138 | "fg": "all", 139 | "idle": "all", 140 | "touch": "c1", 141 | "boost": "all" 142 | }, 143 | "gtmain": { 144 | "bg": "", 145 | "fg": "all", 146 | "idle": "all", 147 | "touch": "c2", 148 | "boost": "all" 149 | } 150 | }, 151 | "prio": { 152 | "auto": { 153 | "bg": 0, 154 | "fg": 0, 155 | "idle": 0, 156 | "touch": 0, 157 | "boost": 0 158 | }, 159 | "bg": { 160 | "bg": -3, 161 | "fg": 139, 162 | "idle": 139, 163 | "touch": 139, 164 | "boost": 139 165 | }, 166 | "norm": { 167 | "bg": -1, 168 | "fg": -1, 169 | "idle": 120, 170 | "touch": 120, 171 | "boost": 130 172 | }, 173 | "coop": { 174 | "bg": -3, 175 | "fg": 124, 176 | "idle": 122, 177 | "touch": 122, 178 | "boost": 130 179 | }, 180 | "ui": { 181 | "bg": -3, 182 | "fg": 120, 183 | "idle": 110, 184 | "touch": 98, 185 | "boost": 116 186 | }, 187 | "rtusr": { 188 | "bg": 98, 189 | "fg": 98, 190 | "idle": 97, 191 | "touch": 97, 192 | "boost": 98 193 | }, 194 | "rtsys": { 195 | "bg": 97, 196 | "fg": 97, 197 | "idle": 96, 198 | "touch": 96, 199 | "boost": 97 200 | } 201 | }, 202 | "rules": [ 203 | { 204 | "name": "Launcher", 205 | "regex": "/HOME_PACKAGE/", 206 | "pinned": true, 207 | "rules": [ 208 | { 209 | "k": "/MAIN_THREAD/", 210 | "ac": "crit", 211 | "pc": "rtusr" 212 | }, 213 | { 214 | "k": "^(RenderThread|GLThread)", 215 | "ac": "crit", 216 | "pc": "rtusr" 217 | }, 218 | { 219 | "k": "^(GPU completion|HWC release|hwui|FramePolicy|ScrollPolicy|ged-swd)", 220 | "ac": "bg", 221 | "pc": "rtusr" 222 | }, 223 | { 224 | "k": ".", 225 | "ac": "auto", 226 | "pc": "auto" 227 | } 228 | ] 229 | }, 230 | { 231 | "name": "SurfaceFlinger", 232 | "regex": "/system/bin/surfaceflinger", 233 | "pinned": true, 234 | "rules": [ 235 | { 236 | "k": "/MAIN_THREAD/", 237 | "ac": "crit", 238 | "pc": "auto" 239 | }, 240 | { 241 | "k": "^(app|RenderEngine)", 242 | "ac": "crit", 243 | "pc": "auto" 244 | }, 245 | { 246 | "k": "^Binder:", 247 | "ac": "auto", 248 | "pc": "auto" 249 | }, 250 | { 251 | "k": ".", 252 | "ac": "bg", 253 | "pc": "auto" 254 | } 255 | ] 256 | }, 257 | { 258 | "name": "SystemServer", 259 | "regex": "system_server", 260 | "pinned": true, 261 | "rules": [ 262 | { 263 | "k": "^(TaskSnapshot|Greezer|CachedApp|SystemPressure|SensorService)|[Mm]emory", 264 | "ac": "bg", 265 | "pc": "auto" 266 | }, 267 | { 268 | "k": "^Async", 269 | "ac": "auto", 270 | "pc": "norm" 271 | }, 272 | { 273 | "k": ".", 274 | "ac": "auto", 275 | "pc": "auto" 276 | } 277 | ] 278 | }, 279 | { 280 | "name": "SystemUI", 281 | "regex": "com.android.systemui", 282 | "pinned": true, 283 | "rules": [ 284 | { 285 | "k": "^(Jit thread pool|HeapTaskDaemon|FinalizerDaemon|ReferenceQueueD)", 286 | "ac": "bg", 287 | "pc": "auto" 288 | }, 289 | { 290 | "k": ".", 291 | "ac": "auto", 292 | "pc": "auto" 293 | } 294 | ] 295 | }, 296 | { 297 | "name": "MediaProvider", 298 | "regex": "^com.android.providers.media", 299 | "pinned": true, 300 | "rules": [ 301 | { 302 | "k": ".", 303 | "ac": "auto", 304 | "pc": "bg" 305 | } 306 | ] 307 | }, 308 | { 309 | "name": "Memory reclaim", 310 | "regex": "swapd|compactd", 311 | "pinned": true, 312 | "rules": [ 313 | { 314 | "k": ".", 315 | "ac": "auto", 316 | "pc": "bg" 317 | } 318 | ] 319 | }, 320 | { 321 | "name": "Phone", 322 | "regex": "com.android.phone", 323 | "pinned": false, 324 | "rules": [ 325 | { 326 | "k": ".", 327 | "ac": "auto", 328 | "pc": "auto" 329 | } 330 | ] 331 | }, 332 | { 333 | "name": "Other system processes", 334 | "regex": "^(/system|/vendor|magiskd|zygiskd)|@|-service$", 335 | "pinned": false, 336 | "rules": [ 337 | { 338 | "k": ".", 339 | "ac": "auto", 340 | "pc": "auto" 341 | } 342 | ] 343 | }, 344 | { 345 | "name": "App co-process", 346 | "regex": "[.].+:", 347 | "pinned": false, 348 | "rules": [ 349 | { 350 | "k": "^(Jit thread pool|HeapTaskDaemon|FinalizerDaemon|ReferenceQueueD)", 351 | "ac": "bg", 352 | "pc": "auto" 353 | } 354 | ] 355 | }, 356 | { 357 | "name": "Default rule", 358 | "regex": ".", 359 | "pinned": false, 360 | "rules": [ 361 | { 362 | "k": "/MAIN_THREAD/", 363 | "ac": "ui", 364 | "pc": "ui" 365 | }, 366 | { 367 | "k": "^(UnityMain|RenderThread |GameThread)", 368 | "ac": "gtmain", 369 | "pc": "auto" 370 | }, 371 | { 372 | "k": "^(Unity|Worker Thread|TaskGraph|RHIThread|GLThread|Thread-|Job.Worker)", 373 | "ac": "gtcoop", 374 | "pc": "auto" 375 | }, 376 | { 377 | "k": "^(RenderThread|JNISurfaceText|IJK_External_Re)|[Aa]nim|([.]raster|[.]ui)$", 378 | "ac": "ui", 379 | "pc": "ui" 380 | }, 381 | { 382 | "k": "^(Chrome_InProc|CrRendererMain|CrGpuMain|CompositorTile)", 383 | "ac": "norm", 384 | "pc": "auto" 385 | }, 386 | { 387 | "k": "^(Viz|Chrome_|Compositor)|[Vv]sync|mali-", 388 | "ac": "ui", 389 | "pc": "ui" 390 | }, 391 | { 392 | "k": "^(OkHttp|Ysa|Xqa|Rx|APM|TVKDL-|tp-|cgi-|ODCP-|Bugly|xlog_)", 393 | "ac": "bg", 394 | "pc": "auto" 395 | }, 396 | { 397 | "k": "^(xg_vip_service|Profile|SearchDaemon|default_matrix|FrameDecoder|FrameSeq)", 398 | "ac": "bg", 399 | "pc": "auto" 400 | }, 401 | { 402 | "k": "^(GPU completion|HWC release|hwui|FramePolicy|ScrollPolicy|ged-swd)", 403 | "ac": "bg", 404 | "pc": "rtusr" 405 | }, 406 | { 407 | "k": "^(JS|libweexjsb|WeexJsBridge|mqt_native|mqt_js|JavaScriptTh)", 408 | "ac": "norm", 409 | "pc": "coop" 410 | }, 411 | { 412 | "k": "^(pool-|glide-|launcher-|Fresco)|[Dd]ownload|[Ss]chedule|[Ww]ork|[Pp]ool|[Dd]efau", 413 | "ac": "norm", 414 | "pc": "coop" 415 | }, 416 | { 417 | "k": ".", 418 | "ac": "norm", 419 | "pc": "auto" 420 | } 421 | ] 422 | } 423 | ] 424 | } 425 | }, 426 | "initials": { 427 | "cpu": { 428 | "baseSampleTime": 0.01, 429 | "baseSlackTime": 0.01, 430 | "latencyTime": 0.5, 431 | "slowLimitPower": 3.0, 432 | "fastLimitPower": 6.0, 433 | "fastLimitCapacity": 10.0, 434 | "fastLimitRecoverScale": 0.3, 435 | "predictThd": 0.3, 436 | "margin": 0.2, 437 | "burst": 0.0, 438 | "guideCap": true, 439 | "limitEfficiency": false 440 | }, 441 | "sysfs": { 442 | "cpusetTa": "0-7", 443 | "cpusetFg": "0-3,6-7", 444 | "cpusetBg": "0-3", 445 | "cpusetSysBg": "0-3", 446 | "cpusetRe": "0-3,6-7" 447 | }, 448 | "sched": { 449 | "scene": "idle" 450 | } 451 | }, 452 | "presets": { 453 | "balance": { 454 | "*": { 455 | "cpu.latencyTime": 0.2, 456 | "cpu.slowLimitPower": 2.0, 457 | "cpu.fastLimitPower": 2.0, 458 | "cpu.fastLimitCapacity": 16.0, 459 | "cpu.margin": 0.2 460 | }, 461 | "idle": { 462 | "cpu.baseSampleTime": 0.04, 463 | "cpu.baseSlackTime": 0.08, 464 | "cpu.predictThd": 0.3, 465 | "cpu.limitEfficiency": true, 466 | "sched.scene": "idle" 467 | }, 468 | "touch": { 469 | "cpu.baseSampleTime": 0.04, 470 | "sched.scene": "touch" 471 | }, 472 | "trigger": { 473 | "cpu.latencyTime": 0.0, 474 | "cpu.margin": 0.4, 475 | "sched.scene": "touch" 476 | }, 477 | "gesture": { 478 | "cpu.margin": 0.6, 479 | "sched.scene": "touch" 480 | }, 481 | "junk": { 482 | "cpu.burst": 0.7, 483 | "sched.scene": "touch" 484 | }, 485 | "switch": { 486 | "cpu.latencyTime": 0.0, 487 | "cpu.slowLimitPower": 3.0, 488 | "cpu.fastLimitPower": 5.0, 489 | "cpu.fastLimitRecoverScale": 0.1, 490 | "cpu.margin": 0.4, 491 | "sched.scene": "boost" 492 | } 493 | }, 494 | "powersave": { 495 | "*": { 496 | "cpu.latencyTime": 0.4, 497 | "cpu.slowLimitPower": 1.0, 498 | "cpu.fastLimitPower": 1.0, 499 | "cpu.fastLimitCapacity": 4.0, 500 | "cpu.margin": 0.1 501 | }, 502 | "idle": { 503 | "cpu.baseSampleTime": 0.04, 504 | "cpu.baseSlackTime": 0.08, 505 | "cpu.predictThd": 1.0, 506 | "cpu.limitEfficiency": true, 507 | "sched.scene": "idle" 508 | }, 509 | "touch": { 510 | "cpu.baseSampleTime": 0.04, 511 | "sched.scene": "touch" 512 | }, 513 | "trigger": { 514 | "cpu.latencyTime": 0.0, 515 | "cpu.margin": 0.1, 516 | "sched.scene": "touch" 517 | }, 518 | "gesture": { 519 | "cpu.margin": 0.2, 520 | "sched.scene": "touch" 521 | }, 522 | "junk": { 523 | "cpu.burst": 0.1, 524 | "sched.scene": "touch" 525 | }, 526 | "switch": { 527 | "cpu.latencyTime": 0.0, 528 | "cpu.slowLimitPower": 1.5, 529 | "cpu.fastLimitPower": 2.5, 530 | "cpu.fastLimitRecoverScale": 0.1, 531 | "cpu.margin": 0.3, 532 | "sched.scene": "boost" 533 | } 534 | }, 535 | "performance": { 536 | "*": { 537 | "cpu.latencyTime": 0.0, 538 | "cpu.slowLimitPower": 999.0, 539 | "cpu.fastLimitPower": 999.0, 540 | "cpu.fastLimitCapacity": 999.0, 541 | "cpu.margin": 0.4, 542 | "cpu.burst": 0.55 543 | }, 544 | "idle": { 545 | "sched.scene": "idle" 546 | }, 547 | "touch": { 548 | "sched.scene": "touch" 549 | }, 550 | "trigger": { 551 | "sched.scene": "touch" 552 | }, 553 | "gesture": { 554 | "sched.scene": "touch" 555 | }, 556 | "junk": { 557 | "cpu.burst": 0.6, 558 | "sched.scene": "touch" 559 | }, 560 | "switch": { 561 | "sched.scene": "boost" 562 | } 563 | }, 564 | "fast": { 565 | "*": { 566 | "cpu.latencyTime": 0.0, 567 | "cpu.slowLimitPower": 999.0, 568 | "cpu.fastLimitPower": 999.0, 569 | "cpu.fastLimitCapacity": 999.0, 570 | "cpu.margin": 1.0 571 | }, 572 | "idle": { 573 | "sched.scene": "idle" 574 | }, 575 | "touch": { 576 | "sched.scene": "touch" 577 | }, 578 | "trigger": { 579 | "sched.scene": "touch" 580 | }, 581 | "gesture": { 582 | "sched.scene": "touch" 583 | }, 584 | "junk": { 585 | "sched.scene": "touch" 586 | }, 587 | "switch": { 588 | "sched.scene": "boost" 589 | } 590 | } 591 | } 592 | } -------------------------------------------------------------------------------- /magisk/customize.sh: -------------------------------------------------------------------------------- 1 | SKIPUNZIP=0 2 | sh $MODPATH/script/setup.sh 3 | [ "$?" != "0" ] && abort 4 | -------------------------------------------------------------------------------- /magisk/initsvc.sh: -------------------------------------------------------------------------------- 1 | #!/vendor/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | BASEDIR="$(dirname $(readlink -f "$0"))" 19 | . $BASEDIR/pathinfo.sh 20 | . $BASEDIR/libcommon.sh 21 | . $BASEDIR/libuperf.sh 22 | 23 | # create busybox symlinks 24 | $BIN_PATH/busybox/busybox --install -s $BIN_PATH/busybox 25 | 26 | # support vtools 27 | cp -af $SCRIPT_PATH/vtools_powercfg.sh /data/powercfg.sh 28 | cp -af $SCRIPT_PATH/vtools_powercfg.sh /data/powercfg-base.sh 29 | cp -af $SCRIPT_PATH/powercfg.json /data/powercfg.json 30 | chmod 755 /data/powercfg.sh 31 | chmod 755 /data/powercfg-base.sh 32 | echo "sh $SCRIPT_PATH/powercfg_main.sh \"\$1\"" >>/data/powercfg.sh 33 | 34 | wait_until_login 35 | 36 | sh $SCRIPT_PATH/powercfg_once.sh 37 | sh $SCRIPT_PATH/platform_special.sh 38 | sh $SCRIPT_PATH/miui_migt.sh 39 | uperf_start 40 | -------------------------------------------------------------------------------- /magisk/libcgroup.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # process scan cache 19 | ps_ret="" 20 | 21 | # launcher&home usually in foreground cpuset group 22 | # reserve one LITTLE for hwservicemanager which will block composer 23 | # thread priority settings not working on hwservicemanager 24 | # okay, disabling perf-hal resulting hwservicemanager frequently wakeup 25 | # CPUMASK_LOW="0e" 26 | # CPUMASK_MID="73" 27 | # CPUMASK_HIGH="f0" 28 | # CPUID_LOW="1-3" 29 | # CPUID_MID="0-1,4-7" # uperf set 0-1/0-6 for foreground, cpu7 reserved for launcher 30 | # CPUID_HIGH="4-7" 31 | 32 | # $1:task_name $2:cgroup_name $3:"cpuset"/"stune" 33 | change_task_cgroup() { 34 | local comm 35 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 36 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 37 | comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" 38 | echo "$temp_tid" >"/dev/$3/$2/tasks" 39 | done 40 | done 41 | } 42 | 43 | # $1:process_name $2:cgroup_name $3:"cpuset"/"stune" 44 | change_proc_cgroup() { 45 | local comm 46 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 47 | comm="$(cat /proc/$temp_pid/comm)" 48 | echo $temp_pid >"/dev/$3/$2/cgroup.procs" 49 | done 50 | } 51 | 52 | # $1:task_name $2:thread_name $3:cgroup_name $4:"cpuset"/"stune" 53 | change_thread_cgroup() { 54 | local comm 55 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 56 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 57 | comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" 58 | if [ "$(echo $comm | grep -i -E "$2")" != "" ]; then 59 | echo "$temp_tid" >"/dev/$4/$3/tasks" 60 | fi 61 | done 62 | done 63 | } 64 | 65 | # $1:task_name $2:cgroup_name $3:"cpuset"/"stune" 66 | change_main_thread_cgroup() { 67 | local comm 68 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 69 | comm="$(cat /proc/$temp_pid/comm)" 70 | echo $temp_pid >"/dev/$3/$2/tasks" 71 | done 72 | } 73 | 74 | # $1:task_name $2:hex_mask(0x00000003 is CPU0 and CPU1) 75 | change_task_affinity() { 76 | local comm 77 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 78 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 79 | comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" 80 | taskset -p "$2" "$temp_tid" >>$LOG_FILE 81 | done 82 | done 83 | } 84 | 85 | # $1:task_name $2:thread_name $3:hex_mask(0x00000003 is CPU0 and CPU1) 86 | change_thread_affinity() { 87 | local comm 88 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 89 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 90 | comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" 91 | if [ "$(echo $comm | grep -i -E "$2")" != "" ]; then 92 | taskset -p "$3" "$temp_tid" >>$LOG_FILE 93 | fi 94 | done 95 | done 96 | } 97 | 98 | # $1:task_name $2:nice(relative to 120) 99 | change_task_nice() { 100 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 101 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 102 | renice -n +40 -p "$temp_tid" 103 | renice -n -19 -p "$temp_tid" 104 | renice -n "$2" -p "$temp_tid" 105 | done 106 | done 107 | } 108 | 109 | # $1:task_name $2:thread_name $3:nice(relative to 120) 110 | change_thread_nice() { 111 | local comm 112 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 113 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 114 | comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" 115 | if [ "$(echo $comm | grep -i -E "$2")" != "" ]; then 116 | renice -n +40 -p "$temp_tid" 117 | renice -n -19 -p "$temp_tid" 118 | renice -n "$3" -p "$temp_tid" 119 | fi 120 | done 121 | done 122 | } 123 | 124 | # $1:task_name $2:priority(99-x, 1<=x<=99) 125 | change_task_rt() { 126 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 127 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 128 | comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" 129 | chrt -f -p "$2" "$temp_tid" >>$LOG_FILE 130 | done 131 | done 132 | } 133 | 134 | # $1:task_name $2:thread_name $3:priority(99-x, 1<=x<=99) 135 | change_thread_rt() { 136 | local comm 137 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 138 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 139 | comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" 140 | if [ "$(echo $comm | grep -i -E "$2")" != "" ]; then 141 | chrt -f -p "$3" "$temp_tid" >>$LOG_FILE 142 | fi 143 | done 144 | done 145 | } 146 | 147 | # $1:task_name 148 | change_task_high_prio() { 149 | # audio thread nice <= -16 150 | change_task_nice "$1" "-15" 151 | } 152 | 153 | # $1:task_name $2:thread_name 154 | change_thread_high_prio() { 155 | # audio thread nice <= -16 156 | change_thread_nice "$1" "$2" "-15" 157 | } 158 | 159 | # $1:task_name $2:thread_name 160 | unpin_thread() { 161 | change_thread_cgroup "$1" "$2" "" "cpuset" 162 | } 163 | 164 | # $1:task_name $2:thread_name 165 | pin_thread_on_pwr() { 166 | change_thread_cgroup "$1" "$2" "background" "cpuset" 167 | } 168 | 169 | # $1:task_name $2:thread_name 170 | pin_thread_on_mid() { 171 | unpin_thread "$1" "$2" 172 | change_thread_affinity "$1" "$2" "7f" 173 | } 174 | 175 | # $1:task_name $2:thread_name 176 | pin_thread_on_perf() { 177 | unpin_thread "$1" "$2" 178 | change_thread_affinity "$1" "$2" "f0" 179 | } 180 | 181 | # $1:task_name 182 | unpin_proc() { 183 | change_task_cgroup "$1" "" "cpuset" 184 | } 185 | 186 | # $1:task_name 187 | pin_proc_on_pwr() { 188 | change_task_cgroup "$1" "background" "cpuset" 189 | } 190 | 191 | # $1:task_name 192 | pin_proc_on_mid() { 193 | unpin_proc "$1" 194 | change_task_affinity "$1" "7f" 195 | } 196 | 197 | # $1:task_name 198 | pin_proc_on_perf() { 199 | unpin_proc "$1" 200 | change_task_affinity "$1" "f0" 201 | } 202 | 203 | rebuild_process_scan_cache() { 204 | # avoid matching grep itself 205 | # ps -Ao pid,args | grep kswapd 206 | # 150 [kswapd0] 207 | # 16490 grep kswapd 208 | ps_ret="$(ps -Ao pid,args)" 209 | } 210 | -------------------------------------------------------------------------------- /magisk/libcommon.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | ############################### 19 | # Basic tool functions 20 | ############################### 21 | 22 | # $1:value $2:filepaths 23 | lock_val() { 24 | for p in $2; do 25 | if [ -f "$p" ]; then 26 | chown root:root "$p" 27 | chmod 0666 "$p" 28 | echo "$1" >"$p" 29 | chmod 0444 "$p" 30 | fi 31 | done 32 | } 33 | 34 | # $1:value $2:filepaths 35 | mask_val() { 36 | touch /data/local/tmp/mount_mask 37 | for p in $2; do 38 | if [ -f "$p" ]; then 39 | umount "$p" 40 | chmod 0666 "$p" 41 | echo "$1" >"$p" 42 | mount --bind /data/local/tmp/mount_mask "$p" 43 | fi 44 | done 45 | } 46 | 47 | # $1:value $2:filepaths 48 | mutate() { 49 | for p in $2; do 50 | if [ -f "$p" ]; then 51 | chmod 0666 "$p" 52 | echo "$1" >"$p" 53 | fi 54 | done 55 | } 56 | 57 | # $1:file path 58 | lock() { 59 | if [ -f "$1" ]; then 60 | chown root:root "$p" 61 | chmod 0444 "$1" 62 | fi 63 | } 64 | 65 | # $1:value $2:list 66 | has_val_in_list() { 67 | for item in $2; do 68 | if [ "$1" == "$item" ]; then 69 | echo "true" 70 | return 71 | fi 72 | done 73 | echo "false" 74 | } 75 | 76 | ############################### 77 | # Config File Operator 78 | ############################### 79 | 80 | # $1:key $return:value(string) 81 | read_cfg_value() { 82 | local value="" 83 | if [ -f "$PANEL_FILE" ]; then 84 | value="$(grep -i "^$1=" "$PANEL_FILE" | head -n 1 | tr -d ' ' | cut -d= -f2)" 85 | fi 86 | echo "$value" 87 | } 88 | 89 | # $1:content 90 | write_panel() { 91 | echo "$1" >>"$PANEL_FILE" 92 | } 93 | 94 | clear_panel() { 95 | true >"$PANEL_FILE" 96 | } 97 | 98 | wait_until_login() { 99 | # in case of /data encryption is disabled 100 | while [ "$(getprop sys.boot_completed)" != "1" ]; do 101 | sleep 1 102 | done 103 | 104 | # we doesn't have the permission to rw "/sdcard" before the user unlocks the screen 105 | local test_file="/sdcard/Android/.PERMISSION_TEST" 106 | true >"$test_file" 107 | while [ ! -f "$test_file" ]; do 108 | true >"$test_file" 109 | sleep 1 110 | done 111 | rm "$test_file" 112 | } 113 | 114 | ############################### 115 | # Log 116 | ############################### 117 | 118 | # $1:content 119 | log() { 120 | echo "$1" >>"$LOG_FILE" 121 | } 122 | 123 | clear_log() { 124 | true >"$LOG_FILE" 125 | } 126 | -------------------------------------------------------------------------------- /magisk/libpowercfg.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | ############################### 19 | # Powermodes helper functions 20 | ############################### 21 | 22 | # $1:keyword $2:nr_max_matched 23 | get_package_name_by_keyword() { 24 | echo "$(pm list package | grep "$1" | head -n "$2" | cut -d: -f2)" 25 | } 26 | 27 | # $1:"0:576000 4:710400 7:825600" 28 | set_cpufreq_min() { 29 | lock_val "$1" /sys/module/msm_performance/parameters/cpu_min_freq 30 | local key 31 | local val 32 | for kv in $1; do 33 | key=${kv%:*} 34 | val=${kv#*:} 35 | lock_val "$val" /sys/devices/system/cpu/cpu$key/cpufreq/scaling_min_freq 36 | done 37 | } 38 | 39 | # $1:"0:576000 4:710400 7:825600" 40 | set_cpufreq_max() { 41 | lock_val "$1" /sys/module/msm_performance/parameters/cpu_max_freq 42 | local key 43 | local val 44 | for kv in $1; do 45 | key=${kv%:*} 46 | val=${kv#*:} 47 | lock_val "$val" /sys/devices/system/cpu/cpu$key/cpufreq/scaling_max_freq 48 | done 49 | } 50 | 51 | # $1:"schedutil/pl" $2:"0:4 4:3 7:1" 52 | set_governor_param() { 53 | local key 54 | local val 55 | for kv in $2; do 56 | key=${kv%:*} 57 | val=${kv#*:} 58 | lock_val "$val" /sys/devices/system/cpu/cpu$key/cpufreq/$1 59 | # sdm625 hmp 60 | lock_val "$val" /sys/devices/system/cpu/cpufreq/$1 61 | done 62 | } 63 | 64 | # $1:"min_cpus" $2:"0:4 4:3 7:1" 65 | set_corectl_param() { 66 | local key 67 | local val 68 | for kv in $2; do 69 | key=${kv%:*} 70 | val=${kv#*:} 71 | lock_val "$val" /sys/devices/system/cpu/cpu$key/core_ctl/$1 72 | done 73 | } 74 | 75 | # stop before updating cfg 76 | perfhal_stop() { 77 | for i in 0 1 2 3 4; do 78 | for j in 0 1 2 3 4; do 79 | stop "perf-hal-$i-$j" 2>/dev/null 80 | done 81 | done 82 | usleep 500 83 | } 84 | 85 | # start after updating cfg 86 | perfhal_start() { 87 | for i in 0 1 2 3 4; do 88 | for j in 0 1 2 3 4; do 89 | start "perf-hal-$i-$j" 2>/dev/null 90 | done 91 | done 92 | } 93 | -------------------------------------------------------------------------------- /magisk/libsysinfo.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang & yinwanxi 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distriywxuted on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | ############################### 19 | # Platform info functions 20 | ############################### 21 | 22 | # $1:"4.14" return:string_in_version 23 | match_linux_version() { 24 | echo "$(cat /proc/version | grep -i "$1")" 25 | } 26 | 27 | get_socid() { 28 | if [ -f /sys/devices/soc0/soc_id ]; then 29 | echo "$(cat /sys/devices/soc0/soc_id)" 30 | else 31 | echo "$(cat /sys/devices/system/soc/soc0/id)" 32 | fi 33 | } 34 | 35 | get_nr_core() { 36 | echo "$(cat /proc/stat | grep cpu[0-9] | wc -l)" 37 | } 38 | 39 | # $1:cpuid 40 | get_maxfreq() { 41 | echo "$(cat "/sys/devices/system/cpu/cpu$1/cpufreq/cpuinfo_max_freq")" 42 | } 43 | 44 | get_socname() { 45 | echo "$(cat "/sys/devices/soc0/machine"| tr '[A-Z]' '[a-z]')" 46 | } 47 | 48 | is_aarch64() { 49 | if [ "$(getprop ro.product.cpu.abi)" == "arm64-v8a" ]; then 50 | echo "true" 51 | else 52 | echo "false" 53 | fi 54 | } 55 | 56 | is_eas() { 57 | if [ "$(grep sched /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors)" != "" ]; then 58 | echo "true" 59 | else 60 | echo "false" 61 | fi 62 | } 63 | 64 | is_mtk() { 65 | if [ "$(getprop | grep ro.mtk)" != "" ]; then 66 | echo "true" 67 | else 68 | echo "false" 69 | fi 70 | } 71 | 72 | miui_check(){ 73 | if [ "$(printf '%s\n' "90" "$(getprop ro.miui.ui.version.name)" | sort -V | head -n1)" = "90" ]; then 74 | echo "true" 75 | else 76 | echo "false" 77 | fi 78 | } 79 | 80 | _get_sm6150_type() { 81 | case "$(get_socid)" in 82 | 365 | 366) echo "sdm730" ;; 83 | 355 | 369) echo "sdm675" ;; 84 | esac 85 | } 86 | 87 | _get_sdm76x_type() { 88 | if [ "$(get_maxfreq 7)" -gt 2300000 ]; then 89 | echo "sdm765" 90 | else 91 | echo "sdm750" 92 | fi 93 | } 94 | 95 | _get_lahaina_type() { 96 | if [ "$(get_maxfreq 7)" -gt 2600000 ]; then 97 | echo "sdm888" 98 | else 99 | if [ "$(get_maxfreq 4)" -gt 2300000 ]; then 100 | echo "sdm778" 101 | else 102 | echo "sdm780" 103 | fi 104 | fi 105 | } 106 | 107 | _get_taro_type() { 108 | if [ "$(get_socname)" == cape ] || [ "$(get_socname)" == capep ] || [ "$(get_socname)" == ukee ] || [ "$(get_socname)" == ukeep ]; then 109 | echo "sdm8g1+" 110 | else 111 | if [ "$(get_socname)" == waipio ] || [ "$(get_socname)" == waipiop ]; then 112 | echo "sdm8g1" 113 | else 114 | echo "sdm7g1" 115 | fi 116 | fi 117 | } 118 | 119 | # $1:board_name 120 | get_config_name() { 121 | case "$1" in 122 | "pineapple") echo "sdm8g3" ;; 123 | "kalama") echo "sdm8g2" ;; 124 | "taro") echo "$(_get_taro_type)" ;; 125 | "lahaina") echo "$(_get_lahaina_type)" ;; 126 | "shima") echo "$(_get_lahaina_type)" ;; 127 | "yupik") echo "$(_get_lahaina_type)" ;; 128 | "kona") echo "sdm865" ;; # 865, 870 129 | "msmnile") echo "sdm855" ;; # 855, 860 130 | "sdm845") echo "sdm845" ;; 131 | "lito") echo "$(_get_sdm76x_type)" ;; 132 | "sm6150") echo "$(_get_sm6150_type)" ;; 133 | "holi") echo "sdm695" ;; 134 | "sdm710") echo "sdm710" ;; 135 | "msm8939") echo "sdm616" ;; 136 | "msm8916") echo "sdm616" ;; 137 | "MSM8916") echo "sdm616" ;; 138 | "sky") echo "sdm4g2" ;; 139 | "parrot") echo "sdm4g2" ;; 140 | "msm8937") echo "sdm439" ;; 141 | "msm8953") echo "sdm625" ;; # 625 142 | "msm8953pro") echo "sdm625" ;; # 626 143 | "msm8952Pro") echo "sdm653" ;; #653 144 | "msm8952") echo "sdm653" ;; #652 145 | "msm8976SG") echo "sdm653" ;; #653 146 | "sdm660") echo "sdm660" ;; 147 | "sdm636") echo "sdm660" ;; 148 | "trinket") echo "sdm665" ;; # sdm665 149 | "bengal") echo "sdm680" ;; # sdm662 150 | "msm8956") echo "sdm650" ;; 151 | "msm8998") echo "sdm835" ;; 152 | "msm8996") echo "sdm820" ;; 153 | "msm8909") echo "sdm210" ;; 154 | "msm8996pro") echo "sdm820" ;; 155 | "s5e9925") echo "e2200" ;; 156 | "exynos2100") echo "e2100" ;; 157 | "erd8835") echo "e1380" ;; 158 | "universal9925") echo "e2200" ;; 159 | "exynos1080") echo "e1080" ;; 160 | "exynos990") echo "e990" ;; 161 | "universal1080") echo "e1080" ;; 162 | "universal990") echo "e990" ;; 163 | "universal9825") echo "e9820" ;; 164 | "universal9820") echo "e9820" ;; 165 | "universal9810") echo "e9810" ;; 166 | "universal8895") echo "e8895" ;; 167 | "universal8890") echo "e8890" ;; 168 | "universal7420") echo "e7420" ;; 169 | "mt6580") echo "mt6580" ;; 170 | "mt6765") echo "mtp35" ;; # Helio P35(mt6765)/G35(mt6765g)/G37(mt6765h) 171 | "mt6768") echo "mtg80" ;; # Helio P65(mt6768)/G70(mt6769v)/G80(mt6769t)/G85(mt6769z) 172 | "mt6771") echo "mtp70" ;; 173 | "mt6779") echo "mtp90" ;; 174 | "mt6789") echo "mtg99" ;; 175 | "mt6785") echo "mtg90t" ;; 176 | "mt6797") echo "mtx20" ;; 177 | "mt6833") echo "mtd720" ;; 178 | "mt6833p") echo "mtd720" ;; # Dimensity 810 179 | "mt6833v") echo "mtd720" ;; # Dimensity 810 180 | "mt6853") echo "mtd720" ;; 181 | "mt6873") echo "mtd820" ;; 182 | "mt6875") echo "mtd820" ;; 183 | "mt6877") echo "mtd920" ;; 184 | "mt6885") echo "mtd1000" ;; 185 | "mt6886") echo "mtd7000" ;; 186 | "mt6889") echo "mtd1000" ;; 187 | "mt6891") echo "mtd1100" ;; 188 | "mt6893") echo "mtd1200" ;; 189 | "mt6895") echo "mtd8100" ;; 190 | "mt6897") echo "mtd8300" ;; 191 | "mt6983") echo "mtd9000" ;; 192 | "mt6985") echo "mtd9200" ;; 193 | "gs101") echo "gs101" ;; 194 | "gs201") echo "gs201" ;; 195 | "cheetah") echo "gs201" ;; 196 | "husky") echo "gs301" ;; 197 | "zuma") echo "gs301" ;; 198 | "PRL") echo "kirin65x" ;; 199 | "BLN") echo "kirin65x" ;; 200 | "hi6250") echo "kirin65x" ;; 201 | "kirin655") echo "kirin65x" ;; 202 | "kirin658") echo "kirin65x" ;; 203 | "kirin659") echo "kirin65x" ;; 204 | "MAR") echo "kirin710" ;; 205 | "INE") echo "kirin710" ;; 206 | "ANE") echo "kirin710" ;; 207 | "JSN") echo "kirin710" ;; 208 | "kirin710") echo "kirin710" ;; 209 | "JKM-AL20") echo "kirin710" ;; 210 | "STF") echo "kirin960" ;; 211 | "HWI") echo "kirin960" ;; 212 | "kirin960") echo "kirin960" ;; 213 | "hi3660") echo "kirin960" ;; 214 | "CMR") echo "kirin960" ;; 215 | "BKL") echo "kirin970" ;; 216 | "ALP") echo "kirin970" ;; 217 | "COR") echo "kirin970" ;; 218 | "kirin970") echo "kirin970" ;; 219 | "ELE") echo "kirin980" ;; 220 | "kirin980") echo "kirin980" ;; 221 | "hi3650") echo "kirin955" ;; 222 | "FRD") echo "kirin955" ;; 223 | "EVA-TL00") echo "kirin955" ;; 224 | "kirin955") echo "kirin955" ;; 225 | "sp9863a") echo "sp9863" ;; 226 | "sp9863a_1h10") echo "sp9863" ;; 227 | "ums9230") echo "t606" ;; 228 | "ums512") echo "t618" ;; 229 | "ud710") echo "t710" ;; 230 | "ums9620") echo "t770" ;; 231 | "ums9230_1h10") echo "t606" ;; 232 | "ums512_1h10") echo "t618" ;; 233 | "ud710_7h10") echo "t710" ;; 234 | "ums9620_2h10") echo "t770" ;; 235 | *) echo "unsupported" ;; 236 | esac 237 | } 238 | -------------------------------------------------------------------------------- /magisk/libuperf.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | BASEDIR="$(dirname "$0")" 19 | . $BASEDIR/pathinfo.sh 20 | . $BASEDIR/libcommon.sh 21 | . $BASEDIR/libcgroup.sh 22 | 23 | uperf_stop() { 24 | killall uperf 25 | } 26 | 27 | uperf_start() { 28 | # raise inotify limit in case file sync existed 29 | lock_val "1048576" /proc/sys/fs/inotify/max_queued_events 30 | lock_val "1048576" /proc/sys/fs/inotify/max_user_watches 31 | lock_val "1024" /proc/sys/fs/inotify/max_user_instances 32 | 33 | mv $USER_PATH/uperf_log.txt $USER_PATH/uperf_log.txt.bak 34 | if [ -f $BIN_PATH/libc++_shared.so ]; then 35 | ASAN_LIB="$(ls $BIN_PATH/libclang_rt.asan-*-android.so)" 36 | export LD_PRELOAD="$ASAN_LIB $BIN_PATH/libc++_shared.so" 37 | fi 38 | $BIN_PATH/uperf $USER_PATH/uperf.json -o $USER_PATH/uperf_log.txt 39 | 40 | # waiting for uperf initialization 41 | sleep 2 42 | # uperf shouldn't preempt foreground tasks 43 | rebuild_process_scan_cache 44 | change_task_cgroup "uperf" "background" "cpuset" 45 | } 46 | -------------------------------------------------------------------------------- /magisk/miui_migt.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2023 yinwanxi 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | BASEDIR="$(dirname "$(readlink -f "$0")")" 17 | . "$BASEDIR"/pathinfo.sh 18 | . "$BASEDIR"/libcommon.sh 19 | . "$BASEDIR"/libpowercfg.sh 20 | . "$BASEDIR"/libcgroup.sh 21 | . "$BASEDIR"/libsysinfo.sh 22 | 23 | #miui 24 | hide_value() { 25 | if [[ -e "$1" ]]; then 26 | umount "$1" 2>/dev/null 27 | c_path="/cache${1}" 28 | if [[ ! -f "$c_path" ]]; then 29 | mkdir -p "$c_path" 30 | rm -r "$c_path" 31 | fi 32 | chattr -i "$c_path" 33 | cp -f "$1" "$c_path" 34 | if [[ "$2" != "" ]]; then 35 | lock_value "$2" "$1" 36 | fi 37 | mount --bind "$c_path" "$1" 38 | else 39 | echo "$1" Not Found! 40 | fi 41 | } 42 | 43 | set_value() { 44 | value=$1 45 | path=$2 46 | if [[ -f $path ]]; then 47 | current_value="$(cat $path)" 48 | if [[ ! "$current_value" = "$value" ]]; then 49 | chmod 0664 "$path" 50 | echo "$value" > "$path" 51 | fi; 52 | fi; 53 | } 54 | 55 | disable_migt(){ 56 | migt=/sys/module/migt/parameters 57 | if [[ -e $migt ]]; then 58 | hide_value $migt/migt_freq '0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0' 59 | hide_value $migt/glk_freq_limit_start '0' 60 | hide_value $migt/glk_freq_limit_walt '0' 61 | hide_value $migt/glk_maxfreq '0 0 0' 62 | hide_value $migt/glk_minfreq '307200 633600 787200' 63 | hide_value $migt/migt_ceiling_freq '0 0 0' 64 | hide_value $migt/glk_disable '1' 65 | hide_value $migt/mi_freq_enable '0' 66 | hide_value $migt/force_stask_to_big '0' 67 | hide_value $migt/glk_fbreak_enable '0' 68 | hide_value $migt/force_reset_runtime '0' 69 | 70 | settings put secure speed_mode_enable 1 71 | chmod 000 $migt/* 72 | chmod 000 /sys/module/migt 73 | chmod 000 /sys/module/sched_walt/holders/migt/parameters 74 | fi 75 | 76 | glk=/proc/sys/glk 77 | if [[ -d $glk ]]; then 78 | hide_value $glk/glk_disable '1' 79 | hide_value $glk/freq_break_enable '0' 80 | hide_value $glk/game_minfreq_limit '0 0 0' 81 | hide_value $glk/game_maxfreq_limit '0 0 0' 82 | hide_value $glk/game_lowspeed_load '30 30 30' 83 | hide_value $glk/game_hispeed_load '80 80 80' 84 | fi 85 | 86 | migt=/proc/sys/migt 87 | if [[ -d $migt ]]; then 88 | hide_value $migt/force_stask_tob '0' 89 | hide_value $migt/enable_pkg_monitor '0' 90 | hide_value $migt/boost_pid '0' 91 | fi 92 | 93 | chmod 000 /sys/class/misc/migt 94 | chmod 000 /sys/module/sched_walt/holders/migt 95 | } 96 | 97 | migt_away(){ 98 | if [ "$(miui_check)" = "true" ]; then 99 | disable_migt 100 | else 101 | echo "not support" 102 | fi 103 | } 104 | 105 | migt_away -------------------------------------------------------------------------------- /magisk/module.prop: -------------------------------------------------------------------------------- 1 | id=uperf 2 | name=Uperf Game Turbo 3 | version=️1.35 based on uperf 904 4 | versionCode=240424 5 | author=Matt Yang(吟惋兮改) 6 | description=❤️欢迎使用Uperf Game Turbo,使用时有问题可反馈至yinwanxi0107@gmail.com❤️///❤️Welcome to use Uperf Game Turbo. If you have any questions, please send feedback to yinwanxi0107@gmail.com❤️ 7 | updateJson=https://github.com/yinwanxi/Uperf-Game-Turbo/raw/master/version.json 8 | ASOPT_VERSIONCODE=260 9 | -------------------------------------------------------------------------------- /magisk/modules/asoulopt.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinwanxi/Uperf-Game-Turbo/298d3d6bd272102105fc837fa92ffed9ee10dd20/magisk/modules/asoulopt.zip -------------------------------------------------------------------------------- /magisk/pathinfo.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | MODULE_PATH="$(dirname $(readlink -f "$0"))" 19 | MODULE_PATH="${MODULE_PATH%\/script}" 20 | SCRIPT_PATH="$MODULE_PATH/script" 21 | BIN_PATH="$MODULE_PATH/bin" 22 | FLAG_PATH="$MODULE_PATH/flag" 23 | 24 | USER_PATH="/sdcard/Android/yc/uperf" 25 | LOG_FILE="$USER_PATH/initsvc.log" 26 | 27 | # use private busybox 28 | PATH="$BIN_PATH/busybox:$PATH" 29 | -------------------------------------------------------------------------------- /magisk/platform_special.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2023 Ham Jin & yinwanxi 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # Runonce after boot, to speed up the transition of power modes in powercfg 19 | BASEDIR="$(dirname "$(readlink -f "$0")")" 20 | . "$BASEDIR"/pathinfo.sh 21 | . "$BASEDIR"/libcommon.sh 22 | . "$BASEDIR"/libpowercfg.sh 23 | . "$BASEDIR"/libcgroup.sh 24 | . "$BASEDIR"/libsysinfo.sh 25 | 26 | 27 | 28 | # MTK specified 29 | if [ "$(is_mtk)" = "true" ]; then 30 | if [ -d "/data/adb/modules/asoul_affinity_opt" ];then 31 | mask_val "0" /sys/module/mtk_fpsgo/parameters/boost_affinity 32 | mask_val "0" /sys/module/fbt_cpu/parameters/boost_affinity 33 | mask_val "0" /sys/kernel/fpsgo/minitop/enable 34 | else 35 | mask_val "1" /sys/module/mtk_fpsgo/parameters/boost_affinity 36 | mask_val "1" /sys/module/fbt_cpu/parameters/boost_affinity 37 | mask_val "1" /sys/kernel/fpsgo/minitop/enable 38 | fi 39 | mask_val "0" /sys/module/mtk_fpsgo/parameters/perfmgr_enable 40 | mask_val "0" /sys/module/mtk_core_ctl/parameters/policy_enable 41 | # FPSGO thermal 42 | mask_val "0" /sys/kernel/fpsgo/fbt/thrm_enable 43 | mask_val "95000" /sys/kernel/fpsgo/fbt/thrm_temp_th 44 | mask_val "-1" /sys/kernel/fpsgo/fbt/thrm_limit_cpu 45 | mask_val "-1" /sys/kernel/fpsgo/fbt/thrm_sub_cpu 46 | 47 | # Platform specified Config 48 | if [ -d "/proc/gpufreqv2" ]; then 49 | # Disabel auto voltage scaling by MTK 50 | lock_val "disable" /proc/gpufreqv2/aging_mode 51 | #Battery current limit 52 | lock_val "stop 1" /proc/mtk_batoc_throttling/battery_oc_protect_stop 53 | #echo "killing gpu thermal" 54 | for i in $(seq 0 10); do 55 | lock_val "$i 0 0" /proc/gpufreqv2/limit_table 56 | done 57 | lock_val "1 1 1" /proc/gpufreqv2/limit_table 58 | lock_val "3 1 1" /proc/gpufreqv2/limit_table 59 | lock_val "0" /sys/kernel/ged/hal/fastdvfs_mode 60 | else 61 | # Disabel auto voltage scaling by MTK 62 | lock_val "0" /proc/gpufreq/gpufreq_aging_enable 63 | # Enable CPU7 for MTK, MT6893 and before(need modify powerhal) 64 | mask_val "" /sys/devices/system/cpu/sched/cpu_prefer 65 | mask_val "" /sys/devices/system/cpu/sched/set_sched_isolation 66 | for i in $(seq 0 9); do 67 | mask_val "0" "$CPU"/cpu"$i"/sched_load_boost 68 | mask_val "$i" /sys/devices/system/cpu/sched/set_sched_deisolation 69 | done 70 | lock_val "0" /sys/devices/system/cpu/sched/hint_enable 71 | lock_val "65" /sys/devices/system/cpu/sched/hint_load_thresh 72 | #force use ppm 73 | echo "force uperf use PPM" 74 | lock_val "0 3200000" /proc/ppm/policy/hard_userlimit_max_cpu_freq 75 | lock_val "0 3200000" /proc/ppm/policy/hard_userlimit_min_cpu_freq 76 | lock_val "1 3200000" /proc/ppm/policy/hard_userlimit_max_cpu_freq 77 | lock_val "1 3200000" /proc/ppm/policy/hard_userlimit_min_cpu_freq 78 | lock_val "2 3200000" /proc/ppm/policy/hard_userlimit_max_cpu_freq 79 | lock_val "2 3200000" /proc/ppm/policy/hard_userlimit_min_cpu_freq 80 | lock_val "0" /proc/ppm/cobra_limit_to_budget 81 | lock_val "0" /proc/ppm/cobra_budget_to_limit 82 | lock /proc/ppm/policy/* 83 | lock /proc/ppm/* 84 | for i in $(seq 0 8); do 85 | lock_val "$i 0 0" /proc/gpufreq/gpufreq_limit_table 86 | done 87 | mask_val "1 1 1" /proc/gpufreq/gpufreq_limit_table 88 | # MTK-EARA 89 | mask_val "0" /sys/kernel/eara_thermal/enable 90 | fi 91 | else 92 | BUS_DIR="/sys/devices/system/cpu/bus_dcvs" 93 | for d in $(ls $BUS_DIR); do 94 | [ ! -f $BUS_DIR/$d/hw_max_freq ] && continue 95 | MAX_FREQ=$(cat $BUS_DIR/$d/hw_max_freq) 96 | 97 | for df in $(ls $BUS_DIR/$d); do 98 | lock_val "$MAX_FREQ" "$BUS_DIR/$d/$df/max_freq" 99 | done 100 | done 101 | 102 | MIN_PWRLVL=$(($(cat /sys/class/kgsl/kgsl-3d0/num_pwrlevels) - 1)) 103 | mask_val "$MIN_PWRLVL" /sys/class/kgsl/kgsl-3d0/default_pwrlevel 104 | mask_val "$MIN_PWRLVL" /sys/class/kgsl/kgsl-3d0/min_pwrlevel 105 | mask_val "0" /sys/class/kgsl/kgsl-3d0/thermal_pwrlevel 106 | mask_val "0" /sys/class/kgsl/kgsl-3d0/bus_split 107 | mask_val "0" /sys/class/kgsl/kgsl-3d0/force_bus_on 108 | mask_val "0" /sys/class/kgsl/kgsl-3d0/force_clk_on 109 | mask_val "0" /sys/class/kgsl/kgsl-3d0/force_no_nap 110 | mask_val "0" /sys/class/kgsl/kgsl-3d0/force_rail_on 111 | mask_val "0" /sys/class/kgsl/kgsl-3d0/throttling 112 | mask_val "0" /proc/sys/walt/sched_boost 113 | mask_val "0" /sys/module/metis/parameters/cluaff_control 114 | mask_val "0" /sys/module/metis/parameters/mi_fboost_enable 115 | mask_val "0" /sys/module/metis/parameters/mi_freq_enable 116 | mask_val "0" /sys/module/metis/parameters/mi_link_enable 117 | mask_val "0" /sys/module/metis/parameters/mi_switch_enable 118 | mask_val "0" /sys/module/metis/parameters/mi_viptask 119 | mask_val "0" /sys/module/metis/parameters/mpc_fboost_enable 120 | mask_val "0" /sys/module/metis/parameters/vip_link_enable 121 | mask_val "0" /sys/module/perfmgr/parameters/perfmgr_enable 122 | fi 123 | 124 | # OPLUS 125 | mask_val "0" /sys/module/cpufreq_bouncing/parameters/enable 126 | mask_val "0" /proc/task_info/task_sched_info/task_sched_info_enable 127 | mask_val "0" /proc/oplus_scheduler/sched_assist/sched_assist_enabled 128 | for i in 0 1 2;do 129 | mask_val "$i,0,5,3000,3,2000,3,2000" /sys/module/cpufreq_bouncing/parameters/config 130 | done 131 | -------------------------------------------------------------------------------- /magisk/post-fs-data.sh: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2021-2022 Matt Yang 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 | MODDIR=${0%/*} 18 | 19 | if [ -f "$MODDIR/flag/need_recuser" ]; then 20 | rm -f $MODDIR/flag/need_recuser 21 | true >$MODDIR/disable 22 | else 23 | true >$MODDIR/flag/need_recuser 24 | fi 25 | -------------------------------------------------------------------------------- /magisk/powercfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Uperf Game Turbo", 3 | "author": "吟惋兮", 4 | "version": "️❤️吟惋兮❤️️", 5 | "versionCode": 31, 6 | "features": { 7 | "strict": true, 8 | "pedestal": true 9 | }, 10 | "module": "uperf,sfanalysis", 11 | "state": "/sdcard/Android/yc/uperf/cur_powermode.txt", 12 | "entry": "/data/powercfg.sh", 13 | "projectUrl": "https://github.com/yc9559/uperf" 14 | } -------------------------------------------------------------------------------- /magisk/powercfg_main.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | BASEDIR="$(dirname $(readlink -f "$0"))" 19 | . $BASEDIR/pathinfo.sh 20 | 21 | action="$1" 22 | case "$1" in 23 | "powersave" | "balance" | "performance" | "fast" | "auto") echo "$1" >"$USER_PATH/cur_powermode.txt" ;; 24 | "pedestal") echo "performance" >"$USER_PATH/cur_powermode.txt" ;; 25 | "init") echo "balance" >"$USER_PATH/cur_powermode.txt" ;; 26 | *) echo "Failed to apply unknown action '$1'." ;; 27 | esac 28 | -------------------------------------------------------------------------------- /magisk/powercfg_once.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # Runonce after boot, to speed up the transition of power modes in powercfg 19 | 20 | BASEDIR="$(dirname $(readlink -f "$0"))" 21 | . $BASEDIR/pathinfo.sh 22 | . $BASEDIR/libcommon.sh 23 | . $BASEDIR/libpowercfg.sh 24 | . $BASEDIR/libcgroup.sh 25 | 26 | unify_cgroup() { 27 | # clear top-app 28 | for p in $(cat /dev/cpuset/top-app/tasks); do 29 | echo $p >/dev/cpuset/foreground/tasks 30 | done 31 | 32 | # unused 33 | rmdir /dev/cpuset/foreground/boost 34 | 35 | # work with uperf/ContextScheduler 36 | change_task_cgroup "surfaceflinger" "" "cpuset" 37 | change_task_cgroup "system_server" "foreground" "cpuset" 38 | change_task_cgroup "netd|allocator" "foreground" "cpuset" 39 | change_task_cgroup "hardware.media.c2|vendor.mediatek.hardware" "background" "cpuset" 40 | change_task_cgroup "aal_sof|kfps|dsp_send_thread|vdec_ipi_recv|mtk_drm_disp_id|disp_feature|hif_thread|main_thread|rx_thread|ged_" "background" "cpuset" 41 | change_task_cgroup "pp_event|crtc_" "background" "cpuset" 42 | } 43 | 44 | unify_sched() { 45 | # clear stune & uclamp 46 | for d in /dev/stune/*/; do 47 | lock_val "0" $d/schedtune.boost 48 | lock_val "0" $d/schedtune.prefer_idle 49 | done 50 | for d in /dev/cpuctl/*/; do 51 | lock_val "0" $d/cpu.uclamp.min 52 | lock_val "0" $d/cpu.uclamp.latency_sensitive 53 | done 54 | 55 | for d in kernel walt; do 56 | mask_val "0" /proc/sys/$d/sched_force_lb_enable 57 | done 58 | } 59 | 60 | unify_devfreq() { 61 | for df in /sys/class/devfreq; do 62 | for d in $df/*cpubw $df/*gpubw $df/*llccbw $df/*cpu-cpu-llcc-bw $df/*cpu-llcc-ddr-bw $df/*cpu-llcc-lat $df/*llcc-ddr-lat $df/*cpu-ddr-latfloor $df/*cpu-l3-lat $df/*cdsp-l3-lat $df/*cdsp-l3-lat $df/*cpu-ddr-qoslat $df/*bpu-ddr-latfloor $df/*snoc_cnoc_keepalive; do 63 | lock_val "9999000000" "$d/max_freq" 64 | done 65 | done 66 | for d in DDR LLCC L3; do 67 | lock_val "9999000000" "/sys/devices/system/cpu/bus_dcvs/$d/*/max_freq" 68 | done 69 | } 70 | 71 | unify_lpm() { 72 | # Qualcomm enter C-state level 3 took ~500us 73 | lock_val "0" /sys/module/lpm_levels/parameters/lpm_ipi_prediction 74 | lock_val "0" /sys/module/lpm_levels/parameters/lpm_prediction 75 | lock_val "2" /sys/module/lpm_levels/parameters/bias_hyst 76 | for d in kernel walt; do 77 | mask_val "255" /proc/sys/$d/sched_busy_hysteresis_enable_cpus 78 | mask_val "2000000" /proc/sys/$d/sched_busy_hyst_ns 79 | done 80 | } 81 | 82 | disable_hotplug() { 83 | # Exynos hotplug 84 | mutate "0" /sys/power/cpuhotplug/enabled 85 | mutate "0" /sys/devices/system/cpu/cpuhotplug/enabled 86 | 87 | # turn off msm_thermal 88 | lock_val "0" /sys/module/msm_thermal/core_control/enabled 89 | lock_val "N" /sys/module/msm_thermal/parameters/enabled 90 | 91 | # 3rd 92 | lock_val "0" /sys/kernel/intelli_plug/intelli_plug_active 93 | lock_val "0" /sys/module/blu_plug/parameters/enabled 94 | lock_val "0" /sys/devices/virtual/misc/mako_hotplug_control/enabled 95 | lock_val "0" /sys/module/autosmp/parameters/enabled 96 | lock_val "0" /sys/kernel/zen_decision/enabled 97 | 98 | # stop sched core_ctl 99 | set_corectl_param "enable" "0:0 6:0 7:0" 100 | 101 | # bring all cores online 102 | for i in 0 1 2 3 4 5 6 7 8 9; do 103 | lock_val "1" /sys/devices/system/cpu/cpu$i/online 104 | done 105 | } 106 | 107 | disable_kernel_boost() { 108 | # Qualcomm 109 | lock_val "0" "/sys/devices/system/cpu/cpu_boost/*" 110 | lock_val "0" "/sys/devices/system/cpu/cpu_boost/parameters/*" 111 | lock_val "0" "/sys/module/cpu_boost/parameters/*" 112 | lock_val "0" "/sys/module/msm_performance/parameters/*" 113 | lock_val "0" "/sys/kernel/msm_performance/parameters/*" 114 | lock_val "0" "/proc/sys/walt/input_boost/*" 115 | 116 | # no msm_performance limit 117 | set_cpufreq_min "0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0" 118 | set_cpufreq_max "0:9999000 1:9999000 2:9999000 3:9999000 4:9999000 5:9999000 6:9999000 7:9999000" 119 | 120 | # MediaTek 121 | # policy_status 122 | # [0] PPM_POLICY_PTPOD: Meature PMIC buck currents 123 | # [1] PPM_POLICY_UT: Unit test 124 | # [2] PPM_POLICY_FORCE_LIMIT: enabled 125 | # [3] PPM_POLICY_PWR_THRO: enabled 126 | # [4] PPM_POLICY_THERMAL: enabled 127 | # [5] PPM_POLICY_DLPT: Power measurment and power budget managing 128 | # [6] PPM_POLICY_HARD_USER_LIMIT: enabled 129 | # [7] PPM_POLICY_USER_LIMIT: enabled 130 | # [8] PPM_POLICY_LCM_OFF: disabled 131 | # [9] PPM_POLICY_SYS_BOOST: disabled 132 | # [10] PPM_POLICY_HICA: ? 133 | # Usage: echo <1(enable)/0(disable)> > /proc/ppm/policy_status 134 | # use cpufreq interface with PPM_POLICY_HARD_USER_LIMIT enabled, thanks to helloklf@github 135 | lock_val "1" /proc/ppm/enabled 136 | for i in 0 1 2 3 4 5 6 7 8 9 10; do 137 | lock_val "$i 0" /proc/ppm/policy_status 138 | done 139 | lock_val "6 1" /proc/ppm/policy_status 140 | lock_val "enable 0" /proc/perfmgr/tchbst/user/usrtch 141 | lock "/proc/ppm/policy/*" 142 | lock "/proc/ppm/*" 143 | lock_val "0" "/sys/module/mtk_fpsgo/parameters/boost_affinity*" 144 | lock_val "0" "/sys/module/fbt_cpu/parameters/boost_affinity*" 145 | lock_val "9999000" "/sys/kernel/fpsgo/fbt/limit_*" 146 | lock_val "0" /sys/kernel/fpsgo/fbt/switch_idleprefer 147 | lock_val "1" /proc/perfmgr/syslimiter/syslimiter_force_disable 148 | lock_val "300" /sys/kernel/fpsgo/fbt/thrm_temp_th 149 | lock_val "-1" /sys/kernel/fpsgo/fbt/thrm_limit_cpu 150 | lock_val "-1" /sys/kernel/fpsgo/fbt/thrm_sub_cpu 151 | 152 | # Samsung 153 | mutate "0" "/sys/class/input_booster/*" 154 | 155 | # Oneplus 156 | lock_val "N" "/sys/module/control_center/parameters/*" 157 | lock_val "0" /sys/module/aigov/parameters/enable 158 | lock_val "0" "/sys/module/houston/parameters/*" 159 | # OnePlus opchain always pins UX threads on the big cluster 160 | lock_val "0" /sys/module/opchain/parameters/chain_on 161 | 162 | # 3rd 163 | lock_val "0" "/sys/kernel/cpu_input_boost/*" 164 | lock_val "0" "/sys/module/cpu_input_boost/parameters/*" 165 | lock_val "0" "/sys/module/dsboost/parameters/*" 166 | lock_val "0" "/sys/module/devfreq_boost/parameters/*" 167 | } 168 | 169 | disable_userspace_boost() { 170 | # xiaomi vip-task scheduler override 171 | chmod 0000 /dev/migt 172 | for f in /sys/module/migt/parameters/*; do 173 | chmod 0000 $f 174 | done 175 | 176 | # xiaomi perfservice 177 | stop vendor.perfservice 178 | stop miuibooster 179 | # stop vendor.miperf 180 | 181 | # brain service maybe not smart 182 | stop oneplus_brain_service 2>/dev/null 183 | 184 | # Qualcomm perfd 185 | stop perfd 2>/dev/null 186 | 187 | # Qualcomm&MTK perfhal 188 | perfhal_stop 189 | 190 | # libperfmgr 191 | stop vendor.power-hal-1-0 192 | stop vendor.power-hal-1-1 193 | stop vendor.power-hal-1-2 194 | stop vendor.power-hal-1-3 195 | stop vendor.power-hal-aidl 196 | } 197 | 198 | restart_userspace_boost() { 199 | # Qualcomm&MTK perfhal 200 | perfhal_start 201 | 202 | # libperfmgr 203 | start vendor.power-hal-1-0 204 | start vendor.power-hal-1-1 205 | start vendor.power-hal-1-2 206 | start vendor.power-hal-1-3 207 | start vendor.power-hal-aidl 208 | } 209 | 210 | disable_userspace_thermal() { 211 | # yes, let it respawn 212 | killall mi_thermald 213 | # prohibit mi_thermald use cpu thermal interface 214 | for i in 0 2 4 6 7; do 215 | local maxfreq="$(cat /sys/devices/system/cpu/cpu$i/cpufreq/cpuinfo_max_freq)" 216 | [ "$maxfreq" -gt "0" ] && lock_val "cpu$i $maxfreq" /sys/devices/virtual/thermal/thermal_message/cpu_limits 217 | done 218 | } 219 | 220 | restart_userspace_thermal() { 221 | # yes, let it respawn 222 | killall mi_thermald 223 | } 224 | 225 | clear_log 226 | exec 1>$LOG_FILE 227 | # exec 2>&1 228 | echo "PATH=$PATH" 229 | echo "sh=$(which sh)" 230 | 231 | # set permission 232 | disable_kernel_boost 233 | disable_hotplug 234 | unify_sched 235 | unify_devfreq 236 | unify_lpm 237 | 238 | disable_userspace_thermal 239 | restart_userspace_thermal 240 | disable_userspace_boost 241 | restart_userspace_boost 242 | 243 | # unify value 244 | disable_kernel_boost 245 | disable_hotplug 246 | unify_sched 247 | unify_devfreq 248 | unify_lpm 249 | 250 | 251 | BASEDIR="$(dirname "$(readlink -f "$0")")" 252 | . "$BASEDIR"/pathinfo.sh 253 | . "$BASEDIR"/libcommon.sh 254 | . "$BASEDIR"/libpowercfg.sh 255 | . "$BASEDIR"/libcgroup.sh 256 | . "$BASEDIR"/libsysinfo.sh 257 | 258 | 259 | if [ "$(is_mtk)" == "true" ]; then 260 | 261 | stop vendor.thermal-hal-2-0.mtk 262 | 263 | lock_val "0" /sys/module/mtk_core_ctl/parameters/policy_enable 264 | 265 | if [ -d "/proc/gpufreqv2" ]; then 266 | 267 | lock_val "disable" /proc/gpufreqv2/aging_mode 268 | 269 | lock_val "stop 1" /proc/mtk_batoc_throttling/battery_oc_protect_stop 270 | 271 | for i in $(seq 0 10); do 272 | lock_val "$i 0 0" /proc/gpufreqv2/limit_table 273 | done 274 | lock_val "1 1 1" /proc/gpufreqv2/limit_table 275 | lock_val "3 1 1" /proc/gpufreqv2/limit_table 276 | 277 | lock_val "0" /sys/kernel/fpsgo/fbt/thrm_enable 278 | lock_val "300000" /sys/kernel/fpsgo/fbt/thrm_temp_th 279 | elif [ -d "/proc/gpufreq" ]; then 280 | lock_val "0" /sys/module/cache_ctl/parameters/enable 281 | lock_val "0" /proc/gpufreq/gpufreq_aging_enable 282 | lock /sys/devices/system/cpu/sched/set_sched_isolation 283 | for i in $(seq 0 9); do 284 | lock_val "0" "$CPU"/cpu"$i"/sched_load_boost 285 | lock_val "$i" /sys/devices/system/cpu/sched/set_sched_deisolation 286 | done 287 | 288 | #force use ppm 289 | echo "force uperf use PPM" 290 | lock_val "0 3200000" /proc/ppm/policy/hard_userlimit_max_cpu_freq 291 | lock_val "0 3200000" /proc/ppm/policy/hard_userlimit_min_cpu_freq 292 | lock_val "1 3200000" /proc/ppm/policy/hard_userlimit_max_cpu_freq 293 | lock_val "1 3200000" /proc/ppm/policy/hard_userlimit_min_cpu_freq 294 | lock_val "2 3200000" /proc/ppm/policy/hard_userlimit_max_cpu_freq 295 | lock_val "2 3200000" /proc/ppm/policy/hard_userlimit_min_cpu_freq 296 | echo "killing gpu thermal" 297 | for i in $(seq 0 8); do 298 | lock_val "$i 0 0" /proc/gpufreq/gpufreq_limit_table 299 | done 300 | lock_val "1 1 1" /proc/gpufreq/gpufreq_limit_table 301 | # MTK-EARA 302 | lock_val "0" /sys/kernel/eara_thermal/enable 303 | lock_val "0" /proc/wmt_tm/tx_thro 304 | lock_val "-1" /proc/wmt_tm/tx_thro_limit 305 | 306 | lock_val "0" /sys/kernel/fpsgo/fbt/thrm_enable 307 | lock_val "300000" /sys/kernel/fpsgo/fbt/thrm_temp_th 308 | fi 309 | killall -9 vendor.mediatek.hardware.mtkpower@1.0-service 310 | fi 311 | 312 | stop vendor_tcpdump 313 | stop miuibooster 314 | stop mcd_service 315 | 316 | killall -9 mi_thermald -------------------------------------------------------------------------------- /magisk/script/initsvc.sh: -------------------------------------------------------------------------------- 1 | #!/vendor/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | BASEDIR="$(dirname $(readlink -f "$0"))" 19 | . $BASEDIR/pathinfo.sh 20 | . $BASEDIR/libcommon.sh 21 | . $BASEDIR/libuperf.sh 22 | 23 | # create busybox symlinks 24 | $BIN_PATH/busybox/busybox --install -s $BIN_PATH/busybox 25 | 26 | # support vtools 27 | cp -af $SCRIPT_PATH/vtools_powercfg.sh /data/powercfg.sh 28 | cp -af $SCRIPT_PATH/vtools_powercfg.sh /data/powercfg-base.sh 29 | cp -af $SCRIPT_PATH/powercfg.json /data/powercfg.json 30 | chmod 755 /data/powercfg.sh 31 | chmod 755 /data/powercfg-base.sh 32 | echo "sh $SCRIPT_PATH/powercfg_main.sh \"\$1\"" >>/data/powercfg.sh 33 | 34 | wait_until_login 35 | 36 | sh $SCRIPT_PATH/powercfg_once.sh 37 | sh $SCRIPT_PATH/platform_special.sh 38 | sh $SCRIPT_PATH/miui_migt.sh 39 | uperf_start 40 | -------------------------------------------------------------------------------- /magisk/script/libcgroup.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # process scan cache 19 | ps_ret="" 20 | 21 | # launcher&home usually in foreground cpuset group 22 | # reserve one LITTLE for hwservicemanager which will block composer 23 | # thread priority settings not working on hwservicemanager 24 | # okay, disabling perf-hal resulting hwservicemanager frequently wakeup 25 | # CPUMASK_LOW="0e" 26 | # CPUMASK_MID="73" 27 | # CPUMASK_HIGH="f0" 28 | # CPUID_LOW="1-3" 29 | # CPUID_MID="0-1,4-7" # uperf set 0-1/0-6 for foreground, cpu7 reserved for launcher 30 | # CPUID_HIGH="4-7" 31 | 32 | # $1:task_name $2:cgroup_name $3:"cpuset"/"stune" 33 | change_task_cgroup() { 34 | local comm 35 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 36 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 37 | comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" 38 | echo "$temp_tid" >"/dev/$3/$2/tasks" 39 | done 40 | done 41 | } 42 | 43 | # $1:process_name $2:cgroup_name $3:"cpuset"/"stune" 44 | change_proc_cgroup() { 45 | local comm 46 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 47 | comm="$(cat /proc/$temp_pid/comm)" 48 | echo $temp_pid >"/dev/$3/$2/cgroup.procs" 49 | done 50 | } 51 | 52 | # $1:task_name $2:thread_name $3:cgroup_name $4:"cpuset"/"stune" 53 | change_thread_cgroup() { 54 | local comm 55 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 56 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 57 | comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" 58 | if [ "$(echo $comm | grep -i -E "$2")" != "" ]; then 59 | echo "$temp_tid" >"/dev/$4/$3/tasks" 60 | fi 61 | done 62 | done 63 | } 64 | 65 | # $1:task_name $2:cgroup_name $3:"cpuset"/"stune" 66 | change_main_thread_cgroup() { 67 | local comm 68 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 69 | comm="$(cat /proc/$temp_pid/comm)" 70 | echo $temp_pid >"/dev/$3/$2/tasks" 71 | done 72 | } 73 | 74 | # $1:task_name $2:hex_mask(0x00000003 is CPU0 and CPU1) 75 | change_task_affinity() { 76 | local comm 77 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 78 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 79 | comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" 80 | taskset -p "$2" "$temp_tid" >>$LOG_FILE 81 | done 82 | done 83 | } 84 | 85 | # $1:task_name $2:thread_name $3:hex_mask(0x00000003 is CPU0 and CPU1) 86 | change_thread_affinity() { 87 | local comm 88 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 89 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 90 | comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" 91 | if [ "$(echo $comm | grep -i -E "$2")" != "" ]; then 92 | taskset -p "$3" "$temp_tid" >>$LOG_FILE 93 | fi 94 | done 95 | done 96 | } 97 | 98 | # $1:task_name $2:nice(relative to 120) 99 | change_task_nice() { 100 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 101 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 102 | renice -n +40 -p "$temp_tid" 103 | renice -n -19 -p "$temp_tid" 104 | renice -n "$2" -p "$temp_tid" 105 | done 106 | done 107 | } 108 | 109 | # $1:task_name $2:thread_name $3:nice(relative to 120) 110 | change_thread_nice() { 111 | local comm 112 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 113 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 114 | comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" 115 | if [ "$(echo $comm | grep -i -E "$2")" != "" ]; then 116 | renice -n +40 -p "$temp_tid" 117 | renice -n -19 -p "$temp_tid" 118 | renice -n "$3" -p "$temp_tid" 119 | fi 120 | done 121 | done 122 | } 123 | 124 | # $1:task_name $2:priority(99-x, 1<=x<=99) 125 | change_task_rt() { 126 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 127 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 128 | comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" 129 | chrt -f -p "$2" "$temp_tid" >>$LOG_FILE 130 | done 131 | done 132 | } 133 | 134 | # $1:task_name $2:thread_name $3:priority(99-x, 1<=x<=99) 135 | change_thread_rt() { 136 | local comm 137 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 138 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 139 | comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" 140 | if [ "$(echo $comm | grep -i -E "$2")" != "" ]; then 141 | chrt -f -p "$3" "$temp_tid" >>$LOG_FILE 142 | fi 143 | done 144 | done 145 | } 146 | 147 | # $1:task_name 148 | change_task_high_prio() { 149 | # audio thread nice <= -16 150 | change_task_nice "$1" "-15" 151 | } 152 | 153 | # $1:task_name $2:thread_name 154 | change_thread_high_prio() { 155 | # audio thread nice <= -16 156 | change_thread_nice "$1" "$2" "-15" 157 | } 158 | 159 | # $1:task_name $2:thread_name 160 | unpin_thread() { 161 | change_thread_cgroup "$1" "$2" "" "cpuset" 162 | } 163 | 164 | # $1:task_name $2:thread_name 165 | pin_thread_on_pwr() { 166 | change_thread_cgroup "$1" "$2" "background" "cpuset" 167 | } 168 | 169 | # $1:task_name $2:thread_name 170 | pin_thread_on_mid() { 171 | unpin_thread "$1" "$2" 172 | change_thread_affinity "$1" "$2" "7f" 173 | } 174 | 175 | # $1:task_name $2:thread_name 176 | pin_thread_on_perf() { 177 | unpin_thread "$1" "$2" 178 | change_thread_affinity "$1" "$2" "f0" 179 | } 180 | 181 | # $1:task_name 182 | unpin_proc() { 183 | change_task_cgroup "$1" "" "cpuset" 184 | } 185 | 186 | # $1:task_name 187 | pin_proc_on_pwr() { 188 | change_task_cgroup "$1" "background" "cpuset" 189 | } 190 | 191 | # $1:task_name 192 | pin_proc_on_mid() { 193 | unpin_proc "$1" 194 | change_task_affinity "$1" "7f" 195 | } 196 | 197 | # $1:task_name 198 | pin_proc_on_perf() { 199 | unpin_proc "$1" 200 | change_task_affinity "$1" "f0" 201 | } 202 | 203 | rebuild_process_scan_cache() { 204 | # avoid matching grep itself 205 | # ps -Ao pid,args | grep kswapd 206 | # 150 [kswapd0] 207 | # 16490 grep kswapd 208 | ps_ret="$(ps -Ao pid,args)" 209 | } 210 | -------------------------------------------------------------------------------- /magisk/script/libcommon.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | ############################### 19 | # Basic tool functions 20 | ############################### 21 | 22 | # $1:value $2:filepaths 23 | lock_val() { 24 | for p in $2; do 25 | if [ -f "$p" ]; then 26 | chown root:root "$p" 27 | chmod 0666 "$p" 28 | echo "$1" >"$p" 29 | chmod 0444 "$p" 30 | fi 31 | done 32 | } 33 | 34 | # $1:value $2:filepaths 35 | mask_val() { 36 | touch /data/local/tmp/mount_mask 37 | for p in $2; do 38 | if [ -f "$p" ]; then 39 | umount "$p" 40 | chmod 0666 "$p" 41 | echo "$1" >"$p" 42 | mount --bind /data/local/tmp/mount_mask "$p" 43 | fi 44 | done 45 | } 46 | 47 | # $1:value $2:filepaths 48 | mutate() { 49 | for p in $2; do 50 | if [ -f "$p" ]; then 51 | chmod 0666 "$p" 52 | echo "$1" >"$p" 53 | fi 54 | done 55 | } 56 | 57 | # $1:file path 58 | lock() { 59 | if [ -f "$1" ]; then 60 | chown root:root "$p" 61 | chmod 0444 "$1" 62 | fi 63 | } 64 | 65 | # $1:value $2:list 66 | has_val_in_list() { 67 | for item in $2; do 68 | if [ "$1" == "$item" ]; then 69 | echo "true" 70 | return 71 | fi 72 | done 73 | echo "false" 74 | } 75 | 76 | ############################### 77 | # Config File Operator 78 | ############################### 79 | 80 | # $1:key $return:value(string) 81 | read_cfg_value() { 82 | local value="" 83 | if [ -f "$PANEL_FILE" ]; then 84 | value="$(grep -i "^$1=" "$PANEL_FILE" | head -n 1 | tr -d ' ' | cut -d= -f2)" 85 | fi 86 | echo "$value" 87 | } 88 | 89 | # $1:content 90 | write_panel() { 91 | echo "$1" >>"$PANEL_FILE" 92 | } 93 | 94 | clear_panel() { 95 | true >"$PANEL_FILE" 96 | } 97 | 98 | wait_until_login() { 99 | # in case of /data encryption is disabled 100 | while [ "$(getprop sys.boot_completed)" != "1" ]; do 101 | sleep 1 102 | done 103 | 104 | # we doesn't have the permission to rw "/sdcard" before the user unlocks the screen 105 | local test_file="/sdcard/Android/.PERMISSION_TEST" 106 | true >"$test_file" 107 | while [ ! -f "$test_file" ]; do 108 | true >"$test_file" 109 | sleep 1 110 | done 111 | rm "$test_file" 112 | } 113 | 114 | ############################### 115 | # Log 116 | ############################### 117 | 118 | # $1:content 119 | log() { 120 | echo "$1" >>"$LOG_FILE" 121 | } 122 | 123 | clear_log() { 124 | true >"$LOG_FILE" 125 | } 126 | -------------------------------------------------------------------------------- /magisk/script/libpowercfg.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | ############################### 19 | # Powermodes helper functions 20 | ############################### 21 | 22 | # $1:keyword $2:nr_max_matched 23 | get_package_name_by_keyword() { 24 | echo "$(pm list package | grep "$1" | head -n "$2" | cut -d: -f2)" 25 | } 26 | 27 | # $1:"0:576000 4:710400 7:825600" 28 | set_cpufreq_min() { 29 | lock_val "$1" /sys/module/msm_performance/parameters/cpu_min_freq 30 | local key 31 | local val 32 | for kv in $1; do 33 | key=${kv%:*} 34 | val=${kv#*:} 35 | lock_val "$val" /sys/devices/system/cpu/cpu$key/cpufreq/scaling_min_freq 36 | done 37 | } 38 | 39 | # $1:"0:576000 4:710400 7:825600" 40 | set_cpufreq_max() { 41 | lock_val "$1" /sys/module/msm_performance/parameters/cpu_max_freq 42 | local key 43 | local val 44 | for kv in $1; do 45 | key=${kv%:*} 46 | val=${kv#*:} 47 | lock_val "$val" /sys/devices/system/cpu/cpu$key/cpufreq/scaling_max_freq 48 | done 49 | } 50 | 51 | # $1:"schedutil/pl" $2:"0:4 4:3 7:1" 52 | set_governor_param() { 53 | local key 54 | local val 55 | for kv in $2; do 56 | key=${kv%:*} 57 | val=${kv#*:} 58 | lock_val "$val" /sys/devices/system/cpu/cpu$key/cpufreq/$1 59 | # sdm625 hmp 60 | lock_val "$val" /sys/devices/system/cpu/cpufreq/$1 61 | done 62 | } 63 | 64 | # $1:"min_cpus" $2:"0:4 4:3 7:1" 65 | set_corectl_param() { 66 | local key 67 | local val 68 | for kv in $2; do 69 | key=${kv%:*} 70 | val=${kv#*:} 71 | lock_val "$val" /sys/devices/system/cpu/cpu$key/core_ctl/$1 72 | done 73 | } 74 | 75 | # stop before updating cfg 76 | perfhal_stop() { 77 | for i in 0 1 2 3 4; do 78 | for j in 0 1 2 3 4; do 79 | stop "perf-hal-$i-$j" 2>/dev/null 80 | done 81 | done 82 | usleep 500 83 | } 84 | 85 | # start after updating cfg 86 | perfhal_start() { 87 | for i in 0 1 2 3 4; do 88 | for j in 0 1 2 3 4; do 89 | start "perf-hal-$i-$j" 2>/dev/null 90 | done 91 | done 92 | } 93 | -------------------------------------------------------------------------------- /magisk/script/libsysinfo.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang & yinwanxi 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distriywxuted on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | ############################### 19 | # Platform info functions 20 | ############################### 21 | 22 | # $1:"4.14" return:string_in_version 23 | match_linux_version() { 24 | echo "$(cat /proc/version | grep -i "$1")" 25 | } 26 | 27 | get_socid() { 28 | if [ -f /sys/devices/soc0/soc_id ]; then 29 | echo "$(cat /sys/devices/soc0/soc_id)" 30 | else 31 | echo "$(cat /sys/devices/system/soc/soc0/id)" 32 | fi 33 | } 34 | 35 | get_nr_core() { 36 | echo "$(cat /proc/stat | grep cpu[0-9] | wc -l)" 37 | } 38 | 39 | # $1:cpuid 40 | get_maxfreq() { 41 | echo "$(cat "/sys/devices/system/cpu/cpu$1/cpufreq/cpuinfo_max_freq")" 42 | } 43 | 44 | get_socname() { 45 | echo "$(cat "/sys/devices/soc0/machine"| tr '[A-Z]' '[a-z]')" 46 | } 47 | 48 | is_aarch64() { 49 | if [ "$(getprop ro.product.cpu.abi)" == "arm64-v8a" ]; then 50 | echo "true" 51 | else 52 | echo "false" 53 | fi 54 | } 55 | 56 | is_eas() { 57 | if [ "$(grep sched /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors)" != "" ]; then 58 | echo "true" 59 | else 60 | echo "false" 61 | fi 62 | } 63 | 64 | is_mtk() { 65 | if [ "$(getprop | grep ro.mtk)" != "" ]; then 66 | echo "true" 67 | else 68 | echo "false" 69 | fi 70 | } 71 | 72 | miui_check(){ 73 | if [ "$(printf '%s\n' "90" "$(getprop ro.miui.ui.version.name)" | sort -V | head -n1)" = "90" ]; then 74 | echo "true" 75 | else 76 | echo "false" 77 | fi 78 | } 79 | 80 | _get_sm6150_type() { 81 | case "$(get_socid)" in 82 | 365 | 366) echo "sdm730" ;; 83 | 355 | 369) echo "sdm675" ;; 84 | esac 85 | } 86 | 87 | _get_sdm76x_type() { 88 | if [ "$(get_maxfreq 7)" -gt 2300000 ]; then 89 | echo "sdm765" 90 | else 91 | echo "sdm750" 92 | fi 93 | } 94 | 95 | _get_lahaina_type() { 96 | if [ "$(get_maxfreq 7)" -gt 2600000 ]; then 97 | echo "sdm888" 98 | else 99 | if [ "$(get_maxfreq 4)" -gt 2300000 ]; then 100 | echo "sdm778" 101 | else 102 | echo "sdm780" 103 | fi 104 | fi 105 | } 106 | 107 | _get_taro_type() { 108 | if [ "$(get_socname)" == cape ] || [ "$(get_socname)" == capep ] || [ "$(get_socname)" == ukee ] || [ "$(get_socname)" == ukeep ]; then 109 | echo "sdm8g1+" 110 | else 111 | if [ "$(get_socname)" == waipio ] || [ "$(get_socname)" == waipiop ]; then 112 | echo "sdm8g1" 113 | else 114 | echo "sdm7g1" 115 | fi 116 | fi 117 | } 118 | 119 | _get_pinekala_type() { 120 | if [ "$(get_maxfreq 7)" -gt 3000000 ]; then 121 | echo "sdm8g3" 122 | else 123 | echo "sdm7+g3" 124 | fi 125 | } 126 | 127 | _get_kalama_type() { 128 | if [ "$(get_maxfreq 7)" -gt 3300000 ]; then 129 | echo "sdm8cxg2" 130 | else 131 | echo "sdm8g2" 132 | fi 133 | } 134 | 135 | # $1:board_name 136 | get_config_name() { 137 | case "$1" in 138 | "pineapple") echo "$(_get_pinekala_type)" ;; 139 | "kalama") echo "$(_get_kalama_type)" ;; 140 | "taro") echo "$(_get_taro_type)" ;; 141 | "lahaina") echo "$(_get_lahaina_type)" ;; 142 | "shima") echo "$(_get_lahaina_type)" ;; 143 | "yupik") echo "$(_get_lahaina_type)" ;; 144 | "sun") echo "sdm8g4" ;; 145 | "kona") echo "sdm865" ;; # 865, 870 146 | "msmnile") echo "sdm855" ;; # 855, 860 147 | "sdm845") echo "sdm845" ;; 148 | "lito") echo "$(_get_sdm76x_type)" ;; 149 | "sm6150") echo "$(_get_sm6150_type)" ;; 150 | "holi") echo "sdm695" ;; 151 | "sdm710") echo "sdm710" ;; 152 | "msm8939") echo "sdm616" ;; 153 | "msm8916") echo "sdm616" ;; 154 | "MSM8916") echo "sdm616" ;; 155 | "sky") echo "sdm4g2" ;; 156 | "parrot") echo "sdm4g2" ;; 157 | "msm8937") echo "sdm439" ;; 158 | "msm8953") echo "sdm625" ;; # 625 159 | "msm8953pro") echo "sdm625" ;; # 626 160 | "msm8952Pro") echo "sdm653" ;; #653 161 | "msm8952") echo "sdm653" ;; #652 162 | "msm8976SG") echo "sdm653" ;; #653 163 | "sdm660") echo "sdm660" ;; 164 | "sdm636") echo "sdm660" ;; 165 | "trinket") echo "sdm665" ;; # sdm665 166 | "bengal") echo "sdm680" ;; # sdm662 167 | "msm8956") echo "sdm650" ;; 168 | "msm8998") echo "sdm835" ;; 169 | "msm8996") echo "sdm820" ;; 170 | "msm8909") echo "sdm210" ;; 171 | "msm8996pro") echo "sdm820" ;; 172 | "s5e9925") echo "e2200" ;; 173 | "exynos2100") echo "e2100" ;; 174 | "erd8835") echo "e1380" ;; 175 | "universal9925") echo "e2200" ;; 176 | "exynos1080") echo "e1080" ;; 177 | "exynos990") echo "e990" ;; 178 | "universal1080") echo "e1080" ;; 179 | "universal990") echo "e990" ;; 180 | "universal5420") echo "e5420" ;; 181 | "universal9825") echo "e9820" ;; 182 | "universal9820") echo "e9820" ;; 183 | "universal9810") echo "e9810" ;; 184 | "universal8895") echo "e8895" ;; 185 | "universal8890") echo "e8890" ;; 186 | "universal7420") echo "e7420" ;; 187 | "mt6580") echo "mt6580" ;; 188 | "mt6765") echo "mtp35" ;; # Helio P35(mt6765)/G35(mt6765g)/G37(mt6765h) 189 | "mt6768") echo "mtg80" ;; # Helio P65(mt6768)/G70(mt6769v)/G80(mt6769t)/G85(mt6769z) 190 | "mt6771") echo "mtp70" ;; 191 | "mt8175") echo "mt8173" ;; 192 | "mt6779") echo "mtp90" ;; 193 | "mt6789") echo "mtg99" ;; 194 | "mt6785") echo "mtg90t" ;; 195 | "Infinix-X6827") echo "mtg96" ;; 196 | "mt6827") echo "mtg96" ;; 197 | "mt6795") echo "mtx10" ;; 198 | "mt6797") echo "mtx20" ;; 199 | "mt6833") echo "mtd720" ;; 200 | "mt6833p") echo "mtd720" ;; # Dimensity 810 201 | "mt6833v") echo "mtd720" ;; # Dimensity 810 202 | "mt6835") echo "mtd6000" ;; 203 | "mt6853") echo "mtd720" ;; 204 | "mt6873") echo "mtd820" ;; 205 | "mt6875") echo "mtd820" ;; 206 | "mt6877") echo "mtd920" ;; 207 | "mt6855") echo "mtd930" ;; 208 | "cancunf") echo "mtd930" ;; 209 | "mt6885") echo "mtd1000" ;; 210 | "mt6886") echo "mtd7000" ;; 211 | "mt6889") echo "mtd1000" ;; 212 | "mt6891") echo "mtd1100" ;; 213 | "mt6893") echo "mtd1200" ;; 214 | "mt6895") echo "mtd8100" ;; 215 | "mt6897") echo "mtd8300" ;; 216 | "mt6983") echo "mtd9000" ;; 217 | "mt6985") echo "mtd9200" ;; 218 | "mt6989") echo "mtd9300" ;; 219 | "mt6991") echo "mtd9400" ;; 220 | "gs101") echo "gs101" ;; 221 | "gs201") echo "gs201" ;; 222 | "cheetah") echo "gs201" ;; 223 | "husky") echo "gs301" ;; 224 | "zuma") echo "gs301" ;; 225 | "shiba") echo "gs301" ;; 226 | "comet") echo "gs401" ;; 227 | "PRL") echo "kirin65x" ;; 228 | "BLN") echo "kirin65x" ;; 229 | "hi6250") echo "kirin65x" ;; 230 | "kirin655") echo "kirin65x" ;; 231 | "kirin658") echo "kirin65x" ;; 232 | "kirin659") echo "kirin65x" ;; 233 | "MAR") echo "kirin710" ;; 234 | "INE") echo "kirin710" ;; 235 | "ANE") echo "kirin710" ;; 236 | "JSN") echo "kirin710" ;; 237 | "kirin710") echo "kirin710" ;; 238 | "JKM-AL20") echo "kirin710" ;; 239 | "STF") echo "kirin960" ;; 240 | "HWI") echo "kirin960" ;; 241 | "kirin960") echo "kirin960" ;; 242 | "hi3660") echo "kirin960" ;; 243 | "CMR") echo "kirin960" ;; 244 | "BKL") echo "kirin970" ;; 245 | "ALP") echo "kirin970" ;; 246 | "COR") echo "kirin970" ;; 247 | "kirin970") echo "kirin970" ;; 248 | "ELE") echo "kirin980" ;; 249 | "kirin980") echo "kirin980" ;; 250 | "kirin990") echo "kirin990" ;; 251 | "LIO-AL00") echo "kirin990" ;; 252 | "OXP-AN00") echo "kirin990" ;; 253 | "ANA-AN00") echo "kirin990" ;; 254 | "ELS-AN10") echo "kirin990" ;; 255 | "EBG-AN00") echo "kirin990" ;; 256 | "TAS-AN00") echo "kirin990" ;; 257 | "LIO-AN00P") echo "kirin990" ;; 258 | "OXF-AN00") echo "kirin990" ;; 259 | "OCE-AL50") echo "kirin990" ;; 260 | "SCMR-W09") echo "kirin990" ;; 261 | "TAH-AN00m") echo "kirin990" ;; 262 | "kirin9000") echo "kirin9000" ;; 263 | "JAD") echo "kirin9000" ;; 264 | "hi3650") echo "kirin955" ;; 265 | "FRD") echo "kirin955" ;; 266 | "EVA-TL00") echo "kirin955" ;; 267 | "kirin955") echo "kirin955" ;; 268 | "sp9863a") echo "sp9863" ;; 269 | "ums312") echo "t310" ;; 270 | "ums9230") echo "t606" ;; 271 | "ums512") echo "t618" ;; 272 | "ud710") echo "t710" ;; 273 | "ums9620") echo "t770" ;; 274 | "sp9832e") echo "sp9832" ;; 275 | "ums312_2h10") echo "t310" ;; 276 | "ums9230_1h10") echo "t606" ;; 277 | "ums512_1h10") echo "t618" ;; 278 | "ud710_7h10") echo "t710" ;; 279 | "ums9620_2h10") echo "t770" ;; 280 | "sp9832e_1h10") echo "sp9832" ;; 281 | "sp9863a_1h10") echo "sp9863" ;; 282 | *) echo "unsupported" ;; 283 | esac 284 | } 285 | -------------------------------------------------------------------------------- /magisk/script/libuperf.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | BASEDIR="$(dirname "$0")" 19 | . $BASEDIR/pathinfo.sh 20 | . $BASEDIR/libcommon.sh 21 | . $BASEDIR/libcgroup.sh 22 | 23 | uperf_stop() { 24 | killall uperf 25 | } 26 | 27 | uperf_start() { 28 | # raise inotify limit in case file sync existed 29 | lock_val "1048576" /proc/sys/fs/inotify/max_queued_events 30 | lock_val "1048576" /proc/sys/fs/inotify/max_user_watches 31 | lock_val "1024" /proc/sys/fs/inotify/max_user_instances 32 | 33 | mv $USER_PATH/uperf_log.txt $USER_PATH/uperf_log.txt.bak 34 | if [ -f $BIN_PATH/libc++_shared.so ]; then 35 | ASAN_LIB="$(ls $BIN_PATH/libclang_rt.asan-*-android.so)" 36 | export LD_PRELOAD="$ASAN_LIB $BIN_PATH/libc++_shared.so" 37 | fi 38 | $BIN_PATH/uperf $USER_PATH/uperf.json -o $USER_PATH/uperf_log.txt 39 | 40 | # waiting for uperf initialization 41 | sleep 2 42 | # uperf shouldn't preempt foreground tasks 43 | rebuild_process_scan_cache 44 | change_task_cgroup "uperf" "background" "cpuset" 45 | } 46 | -------------------------------------------------------------------------------- /magisk/script/miui_migt.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2023 yinwanxi 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | BASEDIR="$(dirname "$(readlink -f "$0")")" 17 | . "$BASEDIR"/pathinfo.sh 18 | . "$BASEDIR"/libcommon.sh 19 | . "$BASEDIR"/libpowercfg.sh 20 | . "$BASEDIR"/libcgroup.sh 21 | . "$BASEDIR"/libsysinfo.sh 22 | 23 | #miui 24 | hide_value() { 25 | if [[ -e "$1" ]]; then 26 | umount "$1" 2>/dev/null 27 | c_path="/cache${1}" 28 | if [[ ! -f "$c_path" ]]; then 29 | mkdir -p "$c_path" 30 | rm -r "$c_path" 31 | fi 32 | chattr -i "$c_path" 33 | cp -f "$1" "$c_path" 34 | if [[ "$2" != "" ]]; then 35 | lock_value "$2" "$1" 36 | fi 37 | mount --bind "$c_path" "$1" 38 | else 39 | echo "$1" Not Found! 40 | fi 41 | } 42 | 43 | set_value() { 44 | value=$1 45 | path=$2 46 | if [[ -f $path ]]; then 47 | current_value="$(cat $path)" 48 | if [[ ! "$current_value" = "$value" ]]; then 49 | chmod 0664 "$path" 50 | echo "$value" > "$path" 51 | fi; 52 | fi; 53 | } 54 | 55 | disable_migt(){ 56 | migt=/sys/module/migt/parameters 57 | if [[ -e $migt ]]; then 58 | hide_value $migt/migt_freq '0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0' 59 | hide_value $migt/glk_freq_limit_start '0' 60 | hide_value $migt/glk_freq_limit_walt '0' 61 | hide_value $migt/glk_maxfreq '0 0 0' 62 | hide_value $migt/glk_minfreq '307200 633600 787200' 63 | hide_value $migt/migt_ceiling_freq '0 0 0' 64 | hide_value $migt/glk_disable '1' 65 | hide_value $migt/mi_freq_enable '0' 66 | hide_value $migt/force_stask_to_big '0' 67 | hide_value $migt/glk_fbreak_enable '0' 68 | hide_value $migt/force_reset_runtime '0' 69 | 70 | settings put secure speed_mode_enable 1 71 | chmod 000 $migt/* 72 | chmod 000 /sys/module/migt 73 | chmod 000 /sys/module/sched_walt/holders/migt/parameters 74 | fi 75 | 76 | glk=/proc/sys/glk 77 | if [[ -d $glk ]]; then 78 | hide_value $glk/glk_disable '1' 79 | hide_value $glk/freq_break_enable '0' 80 | hide_value $glk/game_minfreq_limit '0 0 0' 81 | hide_value $glk/game_maxfreq_limit '0 0 0' 82 | hide_value $glk/game_lowspeed_load '30 30 30' 83 | hide_value $glk/game_hispeed_load '80 80 80' 84 | fi 85 | 86 | migt=/proc/sys/migt 87 | if [[ -d $migt ]]; then 88 | hide_value $migt/force_stask_tob '0' 89 | hide_value $migt/enable_pkg_monitor '0' 90 | hide_value $migt/boost_pid '0' 91 | fi 92 | 93 | chmod 000 /sys/class/misc/migt 94 | chmod 000 /sys/module/sched_walt/holders/migt 95 | } 96 | 97 | migt_away(){ 98 | if [ "$(miui_check)" = "true" ]; then 99 | disable_migt 100 | else 101 | echo "not support" 102 | fi 103 | } 104 | 105 | migt_away -------------------------------------------------------------------------------- /magisk/script/pathinfo.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | MODULE_PATH="$(dirname $(readlink -f "$0"))" 19 | MODULE_PATH="${MODULE_PATH%\/script}" 20 | SCRIPT_PATH="$MODULE_PATH/script" 21 | BIN_PATH="$MODULE_PATH/bin" 22 | FLAG_PATH="$MODULE_PATH/flag" 23 | 24 | USER_PATH="/sdcard/Android/yc/uperf" 25 | LOG_FILE="$USER_PATH/initsvc.log" 26 | 27 | # use private busybox 28 | PATH="$BIN_PATH/busybox:$PATH" 29 | -------------------------------------------------------------------------------- /magisk/script/platform_special.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2023 Ham Jin & yinwanxi 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # Runonce after boot, to speed up the transition of power modes in powercfg 19 | BASEDIR="$(dirname "$(readlink -f "$0")")" 20 | . "$BASEDIR"/pathinfo.sh 21 | . "$BASEDIR"/libcommon.sh 22 | . "$BASEDIR"/libpowercfg.sh 23 | . "$BASEDIR"/libcgroup.sh 24 | . "$BASEDIR"/libsysinfo.sh 25 | 26 | 27 | 28 | # MTK specified 29 | if [ "$(is_mtk)" = "true" ]; then 30 | if [ -d "/data/adb/modules/asoul_affinity_opt" ];then 31 | mask_val "0" /sys/module/mtk_fpsgo/parameters/boost_affinity 32 | mask_val "0" /sys/module/fbt_cpu/parameters/boost_affinity 33 | mask_val "0" /sys/kernel/fpsgo/minitop/enable 34 | else 35 | mask_val "1" /sys/module/mtk_fpsgo/parameters/boost_affinity 36 | mask_val "1" /sys/module/fbt_cpu/parameters/boost_affinity 37 | mask_val "1" /sys/kernel/fpsgo/minitop/enable 38 | fi 39 | mask_val "0" /sys/module/mtk_fpsgo/parameters/perfmgr_enable 40 | mask_val "0" /sys/module/mtk_core_ctl/parameters/policy_enable 41 | # FPSGO thermal 42 | mask_val "0" /sys/kernel/fpsgo/fbt/thrm_enable 43 | mask_val "95000" /sys/kernel/fpsgo/fbt/thrm_temp_th 44 | mask_val "-1" /sys/kernel/fpsgo/fbt/thrm_limit_cpu 45 | mask_val "-1" /sys/kernel/fpsgo/fbt/thrm_sub_cpu 46 | 47 | # Platform specified Config 48 | if [ -d "/proc/gpufreqv2" ]; then 49 | # Disabel auto voltage scaling by MTK 50 | lock_val "disable" /proc/gpufreqv2/aging_mode 51 | #Battery current limit 52 | lock_val "stop 1" /proc/mtk_batoc_throttling/battery_oc_protect_stop 53 | #echo "killing gpu thermal" 54 | for i in $(seq 0 10); do 55 | lock_val "$i 0 0" /proc/gpufreqv2/limit_table 56 | done 57 | lock_val "1 1 1" /proc/gpufreqv2/limit_table 58 | lock_val "3 1 1" /proc/gpufreqv2/limit_table 59 | lock_val "0" /sys/kernel/ged/hal/fastdvfs_mode 60 | else 61 | # Disabel auto voltage scaling by MTK 62 | lock_val "0" /proc/gpufreq/gpufreq_aging_enable 63 | # Enable CPU7 for MTK, MT6893 and before(need modify powerhal) 64 | mask_val "" /sys/devices/system/cpu/sched/cpu_prefer 65 | mask_val "" /sys/devices/system/cpu/sched/set_sched_isolation 66 | for i in $(seq 0 9); do 67 | mask_val "0" "$CPU"/cpu"$i"/sched_load_boost 68 | mask_val "$i" /sys/devices/system/cpu/sched/set_sched_deisolation 69 | done 70 | lock_val "0" /sys/devices/system/cpu/sched/hint_enable 71 | lock_val "65" /sys/devices/system/cpu/sched/hint_load_thresh 72 | #force use ppm 73 | echo "force uperf use PPM" 74 | lock_val "0 3200000" /proc/ppm/policy/hard_userlimit_max_cpu_freq 75 | lock_val "0 3200000" /proc/ppm/policy/hard_userlimit_min_cpu_freq 76 | lock_val "1 3200000" /proc/ppm/policy/hard_userlimit_max_cpu_freq 77 | lock_val "1 3200000" /proc/ppm/policy/hard_userlimit_min_cpu_freq 78 | lock_val "2 3200000" /proc/ppm/policy/hard_userlimit_max_cpu_freq 79 | lock_val "2 3200000" /proc/ppm/policy/hard_userlimit_min_cpu_freq 80 | lock_val "0" /proc/ppm/cobra_limit_to_budget 81 | lock_val "0" /proc/ppm/cobra_budget_to_limit 82 | lock /proc/ppm/policy/* 83 | lock /proc/ppm/* 84 | for i in $(seq 0 8); do 85 | lock_val "$i 0 0" /proc/gpufreq/gpufreq_limit_table 86 | done 87 | mask_val "1 1 1" /proc/gpufreq/gpufreq_limit_table 88 | # MTK-EARA 89 | mask_val "0" /sys/kernel/eara_thermal/enable 90 | fi 91 | else 92 | BUS_DIR="/sys/devices/system/cpu/bus_dcvs" 93 | for d in $(ls $BUS_DIR); do 94 | [ ! -f $BUS_DIR/$d/hw_max_freq ] && continue 95 | MAX_FREQ=$(cat $BUS_DIR/$d/hw_max_freq) 96 | 97 | for df in $(ls $BUS_DIR/$d); do 98 | lock_val "$MAX_FREQ" "$BUS_DIR/$d/$df/max_freq" 99 | done 100 | done 101 | 102 | MIN_PWRLVL=$(($(cat /sys/class/kgsl/kgsl-3d0/num_pwrlevels) - 1)) 103 | mask_val "$MIN_PWRLVL" /sys/class/kgsl/kgsl-3d0/default_pwrlevel 104 | mask_val "$MIN_PWRLVL" /sys/class/kgsl/kgsl-3d0/min_pwrlevel 105 | mask_val "0" /sys/class/kgsl/kgsl-3d0/thermal_pwrlevel 106 | mask_val "0" /sys/class/kgsl/kgsl-3d0/bus_split 107 | mask_val "0" /sys/class/kgsl/kgsl-3d0/force_bus_on 108 | mask_val "0" /sys/class/kgsl/kgsl-3d0/force_clk_on 109 | mask_val "0" /sys/class/kgsl/kgsl-3d0/force_no_nap 110 | mask_val "0" /sys/class/kgsl/kgsl-3d0/force_rail_on 111 | mask_val "0" /sys/class/kgsl/kgsl-3d0/throttling 112 | mask_val "0" /proc/sys/walt/sched_boost 113 | mask_val "0" /sys/module/metis/parameters/cluaff_control 114 | mask_val "0" /sys/module/metis/parameters/mi_fboost_enable 115 | mask_val "0" /sys/module/metis/parameters/mi_freq_enable 116 | mask_val "0" /sys/module/metis/parameters/mi_link_enable 117 | mask_val "0" /sys/module/metis/parameters/mi_switch_enable 118 | mask_val "0" /sys/module/metis/parameters/mi_viptask 119 | mask_val "0" /sys/module/metis/parameters/mpc_fboost_enable 120 | mask_val "0" /sys/module/metis/parameters/vip_link_enable 121 | mask_val "0" /sys/module/perfmgr/parameters/perfmgr_enable 122 | fi 123 | 124 | # OPLUS 125 | mask_val "0" /sys/module/cpufreq_bouncing/parameters/enable 126 | mask_val "0" /proc/task_info/task_sched_info/task_sched_info_enable 127 | mask_val "0" /proc/oplus_scheduler/sched_assist/sched_assist_enabled 128 | for i in 0 1 2;do 129 | mask_val "$i,0,5,3000,3,2000,3,2000" /sys/module/cpufreq_bouncing/parameters/config 130 | done 131 | -------------------------------------------------------------------------------- /magisk/script/powercfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Uperf Game Turbo", 3 | "author": "吟惋兮", 4 | "version": "️❤️吟惋兮❤️️", 5 | "versionCode": 35, 6 | "features": { 7 | "strict": true, 8 | "pedestal": true 9 | }, 10 | "module": "uperf,sfanalysis", 11 | "state": "/sdcard/Android/yc/uperf/cur_powermode.txt", 12 | "entry": "/data/powercfg.sh", 13 | "projectUrl": "https://github.com/yc9559/uperf" 14 | } -------------------------------------------------------------------------------- /magisk/script/powercfg_main.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | BASEDIR="$(dirname $(readlink -f "$0"))" 19 | . $BASEDIR/pathinfo.sh 20 | 21 | action="$1" 22 | case "$1" in 23 | "powersave" | "balance" | "performance" | "fast" | "auto") echo "$1" >"$USER_PATH/cur_powermode.txt" ;; 24 | "pedestal") echo "performance" >"$USER_PATH/cur_powermode.txt" ;; 25 | "init") echo "balance" >"$USER_PATH/cur_powermode.txt" ;; 26 | *) echo "Failed to apply unknown action '$1'." ;; 27 | esac 28 | -------------------------------------------------------------------------------- /magisk/script/powercfg_once.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # Runonce after boot, to speed up the transition of power modes in powercfg 19 | 20 | BASEDIR="$(dirname $(readlink -f "$0"))" 21 | . $BASEDIR/pathinfo.sh 22 | . $BASEDIR/libcommon.sh 23 | . $BASEDIR/libpowercfg.sh 24 | . $BASEDIR/libcgroup.sh 25 | 26 | unify_cgroup() { 27 | # clear top-app 28 | for p in $(cat /dev/cpuset/top-app/tasks); do 29 | echo $p >/dev/cpuset/foreground/tasks 30 | done 31 | 32 | # unused 33 | rmdir /dev/cpuset/foreground/boost 34 | 35 | # work with uperf/ContextScheduler 36 | change_task_cgroup "surfaceflinger" "" "cpuset" 37 | change_task_cgroup "system_server" "foreground" "cpuset" 38 | change_task_cgroup "netd|allocator" "foreground" "cpuset" 39 | change_task_cgroup "hardware.media.c2|vendor.mediatek.hardware" "background" "cpuset" 40 | change_task_cgroup "aal_sof|kfps|dsp_send_thread|vdec_ipi_recv|mtk_drm_disp_id|disp_feature|hif_thread|main_thread|rx_thread|ged_" "background" "cpuset" 41 | change_task_cgroup "pp_event|crtc_" "background" "cpuset" 42 | } 43 | 44 | unify_sched() { 45 | # clear stune & uclamp 46 | for d in /dev/stune/*/; do 47 | lock_val "0" $d/schedtune.boost 48 | lock_val "0" $d/schedtune.prefer_idle 49 | done 50 | for d in /dev/cpuctl/*/; do 51 | lock_val "0" $d/cpu.uclamp.min 52 | lock_val "0" $d/cpu.uclamp.latency_sensitive 53 | done 54 | 55 | for d in kernel walt; do 56 | mask_val "0" /proc/sys/$d/sched_force_lb_enable 57 | done 58 | } 59 | 60 | unify_devfreq() { 61 | for df in /sys/class/devfreq; do 62 | for d in $df/*cpubw $df/*gpubw $df/*llccbw $df/*cpu-cpu-llcc-bw $df/*cpu-llcc-ddr-bw $df/*cpu-llcc-lat $df/*llcc-ddr-lat $df/*cpu-ddr-latfloor $df/*cpu-l3-lat $df/*cdsp-l3-lat $df/*cdsp-l3-lat $df/*cpu-ddr-qoslat $df/*bpu-ddr-latfloor $df/*snoc_cnoc_keepalive; do 63 | lock_val "9999000000" "$d/max_freq" 64 | done 65 | done 66 | for d in DDR LLCC L3; do 67 | lock_val "9999000000" "/sys/devices/system/cpu/bus_dcvs/$d/*/max_freq" 68 | done 69 | } 70 | 71 | unify_lpm() { 72 | # Qualcomm enter C-state level 3 took ~500us 73 | lock_val "0" /sys/module/lpm_levels/parameters/lpm_ipi_prediction 74 | lock_val "0" /sys/module/lpm_levels/parameters/lpm_prediction 75 | lock_val "2" /sys/module/lpm_levels/parameters/bias_hyst 76 | for d in kernel walt; do 77 | mask_val "255" /proc/sys/$d/sched_busy_hysteresis_enable_cpus 78 | mask_val "2000000" /proc/sys/$d/sched_busy_hyst_ns 79 | done 80 | } 81 | 82 | disable_hotplug() { 83 | # Exynos hotplug 84 | mutate "0" /sys/power/cpuhotplug/enabled 85 | mutate "0" /sys/devices/system/cpu/cpuhotplug/enabled 86 | 87 | # turn off msm_thermal 88 | lock_val "0" /sys/module/msm_thermal/core_control/enabled 89 | lock_val "N" /sys/module/msm_thermal/parameters/enabled 90 | 91 | # 3rd 92 | lock_val "0" /sys/kernel/intelli_plug/intelli_plug_active 93 | lock_val "0" /sys/module/blu_plug/parameters/enabled 94 | lock_val "0" /sys/devices/virtual/misc/mako_hotplug_control/enabled 95 | lock_val "0" /sys/module/autosmp/parameters/enabled 96 | lock_val "0" /sys/kernel/zen_decision/enabled 97 | 98 | # stop sched core_ctl 99 | set_corectl_param "enable" "0:0 6:0 7:0" 100 | 101 | # bring all cores online 102 | for i in 0 1 2 3 4 5 6 7 8 9; do 103 | lock_val "1" /sys/devices/system/cpu/cpu$i/online 104 | done 105 | } 106 | 107 | disable_kernel_boost() { 108 | # Qualcomm 109 | lock_val "0" "/sys/devices/system/cpu/cpu_boost/*" 110 | lock_val "0" "/sys/devices/system/cpu/cpu_boost/parameters/*" 111 | lock_val "0" "/sys/module/cpu_boost/parameters/*" 112 | lock_val "0" "/sys/module/msm_performance/parameters/*" 113 | lock_val "0" "/sys/kernel/msm_performance/parameters/*" 114 | lock_val "0" "/proc/sys/walt/input_boost/*" 115 | 116 | # no msm_performance limit 117 | set_cpufreq_min "0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0" 118 | set_cpufreq_max "0:9999000 1:9999000 2:9999000 3:9999000 4:9999000 5:9999000 6:9999000 7:9999000" 119 | 120 | # MediaTek 121 | # policy_status 122 | # [0] PPM_POLICY_PTPOD: Meature PMIC buck currents 123 | # [1] PPM_POLICY_UT: Unit test 124 | # [2] PPM_POLICY_FORCE_LIMIT: enabled 125 | # [3] PPM_POLICY_PWR_THRO: enabled 126 | # [4] PPM_POLICY_THERMAL: enabled 127 | # [5] PPM_POLICY_DLPT: Power measurment and power budget managing 128 | # [6] PPM_POLICY_HARD_USER_LIMIT: enabled 129 | # [7] PPM_POLICY_USER_LIMIT: enabled 130 | # [8] PPM_POLICY_LCM_OFF: disabled 131 | # [9] PPM_POLICY_SYS_BOOST: disabled 132 | # [10] PPM_POLICY_HICA: ? 133 | # Usage: echo <1(enable)/0(disable)> > /proc/ppm/policy_status 134 | # use cpufreq interface with PPM_POLICY_HARD_USER_LIMIT enabled, thanks to helloklf@github 135 | lock_val "1" /proc/ppm/enabled 136 | for i in 0 1 2 3 4 5 6 7 8 9 10; do 137 | lock_val "$i 0" /proc/ppm/policy_status 138 | done 139 | lock_val "6 1" /proc/ppm/policy_status 140 | lock_val "enable 0" /proc/perfmgr/tchbst/user/usrtch 141 | lock "/proc/ppm/policy/*" 142 | lock "/proc/ppm/*" 143 | lock_val "0" "/sys/module/mtk_fpsgo/parameters/boost_affinity*" 144 | lock_val "0" "/sys/module/fbt_cpu/parameters/boost_affinity*" 145 | lock_val "9999000" "/sys/kernel/fpsgo/fbt/limit_*" 146 | lock_val "0" /sys/kernel/fpsgo/fbt/switch_idleprefer 147 | lock_val "1" /proc/perfmgr/syslimiter/syslimiter_force_disable 148 | lock_val "300" /sys/kernel/fpsgo/fbt/thrm_temp_th 149 | lock_val "-1" /sys/kernel/fpsgo/fbt/thrm_limit_cpu 150 | lock_val "-1" /sys/kernel/fpsgo/fbt/thrm_sub_cpu 151 | 152 | # Samsung 153 | mutate "0" "/sys/class/input_booster/*" 154 | 155 | # Oneplus 156 | lock_val "N" "/sys/module/control_center/parameters/*" 157 | lock_val "0" /sys/module/aigov/parameters/enable 158 | lock_val "0" "/sys/module/houston/parameters/*" 159 | # OnePlus opchain always pins UX threads on the big cluster 160 | lock_val "0" /sys/module/opchain/parameters/chain_on 161 | 162 | # 3rd 163 | lock_val "0" "/sys/kernel/cpu_input_boost/*" 164 | lock_val "0" "/sys/module/cpu_input_boost/parameters/*" 165 | lock_val "0" "/sys/module/dsboost/parameters/*" 166 | lock_val "0" "/sys/module/devfreq_boost/parameters/*" 167 | } 168 | 169 | disable_userspace_boost() { 170 | # xiaomi vip-task scheduler override 171 | chmod 0000 /dev/migt 172 | for f in /sys/module/migt/parameters/*; do 173 | chmod 0000 $f 174 | done 175 | 176 | # xiaomi perfservice 177 | stop vendor.perfservice 178 | stop miuibooster 179 | # stop vendor.miperf 180 | 181 | # brain service maybe not smart 182 | stop oneplus_brain_service 2>/dev/null 183 | 184 | # Qualcomm perfd 185 | stop perfd 2>/dev/null 186 | 187 | # Qualcomm&MTK perfhal 188 | perfhal_stop 189 | 190 | # libperfmgr 191 | stop vendor.power-hal-1-0 192 | stop vendor.power-hal-1-1 193 | stop vendor.power-hal-1-2 194 | stop vendor.power-hal-1-3 195 | stop vendor.power-hal-aidl 196 | } 197 | 198 | restart_userspace_boost() { 199 | # Qualcomm&MTK perfhal 200 | perfhal_start 201 | 202 | # libperfmgr 203 | start vendor.power-hal-1-0 204 | start vendor.power-hal-1-1 205 | start vendor.power-hal-1-2 206 | start vendor.power-hal-1-3 207 | start vendor.power-hal-aidl 208 | } 209 | 210 | disable_userspace_thermal() { 211 | # yes, let it respawn 212 | killall mi_thermald 213 | # prohibit mi_thermald use cpu thermal interface 214 | for i in 0 2 4 6 7; do 215 | local maxfreq="$(cat /sys/devices/system/cpu/cpu$i/cpufreq/cpuinfo_max_freq)" 216 | [ "$maxfreq" -gt "0" ] && lock_val "cpu$i $maxfreq" /sys/devices/virtual/thermal/thermal_message/cpu_limits 217 | done 218 | } 219 | 220 | restart_userspace_thermal() { 221 | # yes, let it respawn 222 | killall mi_thermald 223 | } 224 | 225 | clear_log 226 | exec 1>$LOG_FILE 227 | # exec 2>&1 228 | echo "PATH=$PATH" 229 | echo "sh=$(which sh)" 230 | 231 | # set permission 232 | disable_kernel_boost 233 | disable_hotplug 234 | unify_sched 235 | unify_devfreq 236 | unify_lpm 237 | 238 | disable_userspace_thermal 239 | restart_userspace_thermal 240 | disable_userspace_boost 241 | restart_userspace_boost 242 | 243 | # unify value 244 | disable_kernel_boost 245 | disable_hotplug 246 | unify_sched 247 | unify_devfreq 248 | unify_lpm 249 | 250 | 251 | BASEDIR="$(dirname "$(readlink -f "$0")")" 252 | . "$BASEDIR"/pathinfo.sh 253 | . "$BASEDIR"/libcommon.sh 254 | . "$BASEDIR"/libpowercfg.sh 255 | . "$BASEDIR"/libcgroup.sh 256 | . "$BASEDIR"/libsysinfo.sh 257 | 258 | 259 | if [ "$(is_mtk)" == "true" ]; then 260 | 261 | stop vendor.thermal-hal-2-0.mtk 262 | 263 | lock_val "0" /sys/module/mtk_core_ctl/parameters/policy_enable 264 | 265 | if [ -d "/proc/gpufreqv2" ]; then 266 | 267 | lock_val "disable" /proc/gpufreqv2/aging_mode 268 | 269 | lock_val "stop 1" /proc/mtk_batoc_throttling/battery_oc_protect_stop 270 | 271 | for i in $(seq 0 10); do 272 | lock_val "$i 0 0" /proc/gpufreqv2/limit_table 273 | done 274 | lock_val "1 1 1" /proc/gpufreqv2/limit_table 275 | lock_val "3 1 1" /proc/gpufreqv2/limit_table 276 | 277 | lock_val "0" /sys/kernel/fpsgo/fbt/thrm_enable 278 | lock_val "300000" /sys/kernel/fpsgo/fbt/thrm_temp_th 279 | elif [ -d "/proc/gpufreq" ]; then 280 | lock_val "0" /sys/module/cache_ctl/parameters/enable 281 | lock_val "0" /proc/gpufreq/gpufreq_aging_enable 282 | lock /sys/devices/system/cpu/sched/set_sched_isolation 283 | for i in $(seq 0 9); do 284 | lock_val "0" "$CPU"/cpu"$i"/sched_load_boost 285 | lock_val "$i" /sys/devices/system/cpu/sched/set_sched_deisolation 286 | done 287 | 288 | #force use ppm 289 | echo "force uperf use PPM" 290 | lock_val "0 3200000" /proc/ppm/policy/hard_userlimit_max_cpu_freq 291 | lock_val "0 3200000" /proc/ppm/policy/hard_userlimit_min_cpu_freq 292 | lock_val "1 3200000" /proc/ppm/policy/hard_userlimit_max_cpu_freq 293 | lock_val "1 3200000" /proc/ppm/policy/hard_userlimit_min_cpu_freq 294 | lock_val "2 3200000" /proc/ppm/policy/hard_userlimit_max_cpu_freq 295 | lock_val "2 3200000" /proc/ppm/policy/hard_userlimit_min_cpu_freq 296 | echo "killing gpu thermal" 297 | for i in $(seq 0 8); do 298 | lock_val "$i 0 0" /proc/gpufreq/gpufreq_limit_table 299 | done 300 | lock_val "1 1 1" /proc/gpufreq/gpufreq_limit_table 301 | # MTK-EARA 302 | lock_val "0" /sys/kernel/eara_thermal/enable 303 | lock_val "0" /proc/wmt_tm/tx_thro 304 | lock_val "-1" /proc/wmt_tm/tx_thro_limit 305 | 306 | lock_val "0" /sys/kernel/fpsgo/fbt/thrm_enable 307 | lock_val "300000" /sys/kernel/fpsgo/fbt/thrm_temp_th 308 | fi 309 | killall -9 vendor.mediatek.hardware.mtkpower@1.0-service 310 | fi 311 | 312 | stop vendor_tcpdump 313 | stop miuibooster 314 | stop mcd_service 315 | 316 | killall -9 mi_thermald -------------------------------------------------------------------------------- /magisk/script/setup.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | BASEDIR="$(dirname $(readlink -f "$0"))" 19 | . $BASEDIR/pathinfo.sh 20 | . $BASEDIR/libsysinfo.sh 21 | 22 | # $1:error_message 23 | abort() { 24 | echo "$1" 25 | echo "! Uperf Game Turbo installation failed." 26 | exit 1 27 | } 28 | 29 | # $1:file_node $2:owner $3:group $4:permission $5:secontext 30 | set_perm() { 31 | chown $2:$3 $1 32 | chmod $4 $1 33 | chcon $5 $1 34 | } 35 | 36 | # $1:directory $2:owner $3:group $4:dir_permission $5:file_permission $6:secontext 37 | set_perm_recursive() { 38 | find $1 -type d 2>/dev/null | while read dir; do 39 | set_perm $dir $2 $3 $4 $6 40 | done 41 | find $1 -type f -o -type l 2>/dev/null | while read file; do 42 | set_perm $file $2 $3 $5 $6 43 | done 44 | } 45 | 46 | install_uperf() { 47 | echo "- Finding platform specified config" 48 | echo "- ro.board.platform=$(getprop ro.board.platform)" 49 | echo "- ro.product.board=$(getprop ro.product.board)" 50 | 51 | local target 52 | local cfgname 53 | target="$(getprop ro.board.platform)" 54 | cfgname="$(get_config_name $target)" 55 | if [ "$cfgname" == "unsupported" ]; then 56 | target="$(getprop ro.product.board)" 57 | cfgname="$(get_config_name $target)" 58 | fi 59 | 60 | if [ "$cfgname" == "unsupported" ] || [ ! -f $MODULE_PATH/config/$cfgname.json ]; then 61 | abort "! Target [$target] not supported." 62 | fi 63 | 64 | echo "- Uperf config is located at $USER_PATH" 65 | mkdir -p $USER_PATH 66 | mv -f $USER_PATH/uperf.json $USER_PATH/uperf.json.bak 67 | cp -f $MODULE_PATH/config/$cfgname.json $USER_PATH/uperf.json 68 | [ ! -e "$USER_PATH/perapp_powermode.txt" ] && cp $MODULE_PATH/config/perapp_powermode.txt $USER_PATH/perapp_powermode.txt 69 | rm -rf $MODULE_PATH/config 70 | set_perm_recursive $BIN_PATH 0 0 0755 0755 u:object_r:system_file:s0 71 | } 72 | 73 | 74 | check_asopt() { 75 | echo "❗ 即将为您安装A-SOUL" 76 | echo "❗ 此模块功能为放置游戏线程,优化游戏流畅度" 77 | echo "❗ 作者个人建议安装,因为绝大多数厂商的线程都是乱放的" 78 | echo "❗ 此操作可极大优化游戏流畅度" 79 | echo "❗ 单击音量上键即可确认更新或安装" 80 | echo "❗ 单击音量下键取消更新或安装(不推荐)" 81 | echo " ----------------------------------------------------------" 82 | echo "❗ A-SOUL will be installed for you now" 83 | echo "❗ This module is used to place threads and optimize game fluency" 84 | echo "❗ I recommends installation, because most phone's threads are randomly placed" 85 | echo "❗ This can greatly optimize the game fluency" 86 | echo "❗ Click the volume up to confirm the update or installation" 87 | echo "❗ Click the volume down to cancel the update or installation (not recommended)" 88 | key_click="" 89 | while [ "$key_click" = "" ]; do 90 | key_click="$(getevent -qlc 1 | awk '{ print $3 }' | grep 'KEY_')" 91 | sleep 0.2 92 | done 93 | case "$key_click" in 94 | "KEY_VOLUMEUP") 95 | echo "❗您已确认更新,请稍候" 96 | echo "❗You have confirmed the update, please wait" 97 | install_corp 98 | echo "* 已为您安装ASOUL❤️" 99 | echo "* 感谢您的支持与信任😁" 100 | echo "* ASOUL has been installed for you❤️" 101 | echo "* Thank you for your support and trust😁" 102 | ;; 103 | *) 104 | echo "❗非常遗憾" 105 | echo "❗已为您取消更新ASOUL💔" 106 | echo "❗What a pity" 107 | echo "❗The update of ASOUL has been cancelled for you💔" 108 | esac 109 | rm -rf "$MODULE_PATH"/modules/asoulopt.zip 110 | } 111 | 112 | get_value() { 113 | echo "$(grep -E "^$1=" "$2" | head -n 1 | cut -d= -f2)" 114 | } 115 | 116 | install_corp() { 117 | if [ -d "/data/adb/modules/unity_affinity_opt" ] || [ -d "/data/adb/modules_update/unity_affinity_opt" ]; then 118 | rm /data/adb/modules*/unity_affinity_opt 119 | fi 120 | CUR_ASOPT_VERSIONCODE="$(get_value ASOPT_VERSIONCODE "$MODULE_PATH"/module.prop)" 121 | asopt_module_version="0" 122 | if [ -f "/data/adb/modules/asoul_affinity_opt/module.prop" ]; then 123 | asopt_module_version="$(get_value versionCode /data/adb/modules/asoul_affinity_opt/module.prop)" 124 | echo "- AsoulOpt...current:$asopt_module_version" 125 | echo "- AsoulOpt...embeded:$CUR_ASOPT_VERSIONCODE" 126 | if [ "$CUR_ASOPT_VERSIONCODE" -gt "$asopt_module_version" ]; then 127 | 128 | echo "* 您正在使用旧版asopt️" 129 | echo "* Uperf Game Turbo将为您更新至模块内版本️" 130 | echo "* You are using an old version asopt" 131 | echo "* Updating for you️" 132 | killall -9 AsoulOpt 133 | rm -rf /data/adb/modules*/asoul_affinity_opt 134 | echo "- 正在为您安装asopt" 135 | echo "- Installing️" 136 | magisk --install-module "$MODULE_PATH"/modules/asoulopt.zip 137 | else 138 | echo "* 您正在使用新版本的asopt" 139 | echo "* Uperf Game Turbo将不予操作️" 140 | echo "* You are using new version of asopt" 141 | echo "* Uperf Game Turbo will not operate️" 142 | fi 143 | else 144 | echo "* 您尚未安装asopt" 145 | echo "* Uperf Game Turbo将尝试为您第一次安装️" 146 | echo "* You have not installed asopt" 147 | echo "* Uperf Game Turbo will try to install it for you for the first time" 148 | killall -9 AsoulOpt 149 | rm -rf /data/adb/modules*/asoul_affinity_opt 150 | echo "- 正在为您安装asopt" 151 | echo "- Installing asopt for you" 152 | magisk --install-module "$MODULE_PATH"/modules/asoulopt.zip 153 | fi 154 | rm -rf "$MODULE_PATH"/modules/asoulopt.zip 155 | } 156 | 157 | fix_module_prop() { 158 | mkdir -p /data/adb/modules/uperf/ 159 | cp -f "$MODULE_PATH/module.prop" /data/adb/modules/uperf/module.prop 160 | } 161 | 162 | unlock_limit(){ 163 | if [[ ! -d $MODPATH/system/vendor/etc/perf/ ]];then 164 | dir=$MODPATH/system/vendor/etc/perf/ 165 | mkdir -p $dir 166 | fi 167 | 168 | for i in ` ls /system/vendor/etc/perf/ ` 169 | do 170 | touch $dir/$i 171 | done 172 | } 173 | 174 | echo "" 175 | echo "* Uperf URL: https://github.com/yc9559/uperf/" 176 | echo "* Uperf Game Turbo URL: https://github.com/yinwanxi/Uperf-Game-Turbo" 177 | echo "* Author: Matt Yang ❤️吟惋兮❤️改" 178 | echo "* Version: Game Turbo1.35 based on uperf904" 179 | echo "* 请不要破坏Uperf运行环境" 180 | echo "* 模块会附带安装asopt" 181 | echo "* " 182 | echo "* 极速模式请自备散热,删除温控体验更佳" 183 | echo "* 本模块与限频模块、部分优化模块冲突" 184 | echo "* 模块可能与第三方内核冲突" 185 | echo "* 请自行事先询问内核作者" 186 | echo "* 请不要破坏Uperf Game Turbo运行环境!!!" 187 | echo "* 请不要自行更改/切换CPU调速器!!!" 188 | echo "* " 189 | echo "* ❤️吟惋兮❤️" 190 | echo "- 正在为您安装Uperf Game Turbo❤️" 191 | echo "-----------------------------------------------------" 192 | echo "-----------------------------------------------------" 193 | echo "* Uperf URL: https://github.com/yc9559/uperf/" 194 | echo "* Uperf Game Turbo URL: https://github.com/yinwanxi/Uperf-Game-Turbo" 195 | echo "* Author: Matt Yang ❤️yinwanxi❤️改" 196 | echo "* Version: Game Turbo1.35 based on uperf904" 197 | echo "* Please do not destroy the Uperf running environment" 198 | echo "* Please prepare for heat dissipation at fast mode" 199 | echo "* It is better to delete termal" 200 | echo "* The module will be installed with asopt" 201 | echo "* This module conflicts with the frequency limiting module and some optimization modules" 202 | echo "* Module may conflict with some kernel" 203 | echo "* Please ask the kernel author in advance" 204 | echo "* Please do not destroy the Uperf Game Turbo running environment!!!" 205 | echo "* Please do not change/switch the CPU controller yourself!!!" 206 | echo "* " 207 | echo "* ❤ yinwanxi❤️" 208 | echo "- Installing Uperf Game Turbo for you❤️" 209 | 210 | install_uperf 211 | #unlock_limit 212 | echo "* Uperf Game Turbo安装成功❤️" 213 | echo "* Uperf Game Turbo installed successfully❤️" 214 | #install_corp 215 | check_asopt 216 | echo "* 模块安装完成❤️" 217 | echo "* 重启即可" 218 | echo "* 欢迎使用Uperf Game Turbo" 219 | echo "* 祝体验愉快" 220 | echo "* Module installation completed❤️" 221 | echo "* Please reboot" 222 | echo "* Welcome to Uperf Game Turbo" 223 | echo "* Have a pleasant experience" 224 | fix_module_prop -------------------------------------------------------------------------------- /magisk/script/vtools_powercfg.sh: -------------------------------------------------------------------------------- 1 | #!/vendor/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # powercfg wrapper for com.omarea.vtools 19 | # MAKE SURE THAT THE MAGISK MODULE "Uperf" HAS BEEN INSTALLED 20 | -------------------------------------------------------------------------------- /magisk/service.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | BASEDIR="$(dirname $(readlink -f "$0"))" 19 | 20 | crash_recuser() { 21 | rm $BASEDIR/logcat.log 22 | logcat -f $BASEDIR/logcat.log & 23 | sleep 40 24 | killall logcat 25 | rm -f $BASEDIR/flag/need_recuser 26 | } 27 | 28 | (crash_recuser &) 29 | sh $BASEDIR/script/initsvc.sh 30 | -------------------------------------------------------------------------------- /magisk/setup.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | BASEDIR="$(dirname $(readlink -f "$0"))" 19 | . $BASEDIR/pathinfo.sh 20 | . $BASEDIR/libsysinfo.sh 21 | 22 | # $1:error_message 23 | abort() { 24 | echo "$1" 25 | echo "! Uperf installation failed." 26 | exit 1 27 | } 28 | 29 | # $1:file_node $2:owner $3:group $4:permission $5:secontext 30 | set_perm() { 31 | chown $2:$3 $1 32 | chmod $4 $1 33 | chcon $5 $1 34 | } 35 | 36 | # $1:directory $2:owner $3:group $4:dir_permission $5:file_permission $6:secontext 37 | set_perm_recursive() { 38 | find $1 -type d 2>/dev/null | while read dir; do 39 | set_perm $dir $2 $3 $4 $6 40 | done 41 | find $1 -type f -o -type l 2>/dev/null | while read file; do 42 | set_perm $file $2 $3 $5 $6 43 | done 44 | } 45 | 46 | install_uperf() { 47 | echo "- Finding platform specified config" 48 | echo "- ro.board.platform=$(getprop ro.board.platform)" 49 | echo "- ro.product.board=$(getprop ro.product.board)" 50 | 51 | local target 52 | local cfgname 53 | target="$(getprop ro.board.platform)" 54 | cfgname="$(get_config_name $target)" 55 | if [ "$cfgname" == "unsupported" ]; then 56 | target="$(getprop ro.product.board)" 57 | cfgname="$(get_config_name $target)" 58 | fi 59 | 60 | if [ "$cfgname" == "unsupported" ] || [ ! -f $MODULE_PATH/config/$cfgname.json ]; then 61 | abort "! Target [$target] not supported." 62 | fi 63 | 64 | echo "- Uperf config is located at $USER_PATH" 65 | mkdir -p $USER_PATH 66 | mv -f $USER_PATH/uperf.json $USER_PATH/uperf.json.bak 67 | cp -f $MODULE_PATH/config/$cfgname.json $USER_PATH/uperf.json 68 | [ ! -e "$USER_PATH/perapp_powermode.txt" ] && cp $MODULE_PATH/config/perapp_powermode.txt $USER_PATH/perapp_powermode.txt 69 | rm -rf $MODULE_PATH/config 70 | set_perm_recursive $BIN_PATH 0 0 0755 0755 u:object_r:system_file:s0 71 | } 72 | 73 | 74 | check_asopt() { 75 | echo "❗ 即将为您安装A-SOUL" 76 | echo "❗ 此模块功能为放置游戏线程,优化游戏流畅度" 77 | echo "❗ 作者个人建议安装,因为绝大多数厂商的线程都是乱放的" 78 | echo "❗ 此线程可极大优化游戏流畅度" 79 | echo "❗ 单击音量上键即可确认更新或安装" 80 | echo "❗ 单击音量下键取消更新或安装(不推荐)" 81 | key_click="" 82 | while [ "$key_click" = "" ]; do 83 | key_click="$(getevent -qlc 1 | awk '{ print $3 }' | grep 'KEY_')" 84 | sleep 0.2 85 | done 86 | case "$key_click" in 87 | "KEY_VOLUMEUP") 88 | echo "❗您已确认更新,请稍候" 89 | install_corp 90 | echo "* 已为您安装ASOUL❤️" 91 | echo "* 感谢您的支持与信任😁" 92 | ;; 93 | *) 94 | echo "❗非常遗憾" 95 | echo "❗已为您取消更新ASOUL💔" 96 | esac 97 | rm -rf "$MODULE_PATH"/modules/asoulopt.zip 98 | } 99 | 100 | get_value() { 101 | echo "$(grep -E "^$1=" "$2" | head -n 1 | cut -d= -f2)" 102 | } 103 | 104 | install_corp() { 105 | if [ -d "/data/adb/modules/unity_affinity_opt" ] || [ -d "/data/adb/modules_update/unity_affinity_opt" ]; then 106 | rm /data/adb/modules*/unity_affinity_opt 107 | fi 108 | CUR_ASOPT_VERSIONCODE="$(get_value ASOPT_VERSIONCODE "$MODULE_PATH"/module.prop)" 109 | asopt_module_version="0" 110 | if [ -f "/data/adb/modules/asoul_affinity_opt/module.prop" ]; then 111 | asopt_module_version="$(get_value versionCode /data/adb/modules/asoul_affinity_opt/module.prop)" 112 | echo "- AsoulOpt...current:$asopt_module_version" 113 | echo "- AsoulOpt...embeded:$CUR_ASOPT_VERSIONCODE" 114 | if [ "$CUR_ASOPT_VERSIONCODE" -gt "$asopt_module_version" ]; then 115 | 116 | echo "* 您正在使用旧版asopt️" 117 | echo "* Uperf Game Turbo将为您更新至模块内版本️" 118 | killall -9 AsoulOpt 119 | rm -rf /data/adb/modules*/asoul_affinity_opt 120 | echo "- 正在为您安装asopt" 121 | magisk --install-module "$MODULE_PATH"/modules/asoulopt.zip 122 | else 123 | echo "* 您正在使用新版本的asopt" 124 | echo "* Uperf Game Turbo将不予操作️" 125 | fi 126 | else 127 | echo "* 您尚未安装asopt" 128 | echo "* Uperf Game Turbo将尝试为您第一次安装️" 129 | killall -9 AsoulOpt 130 | rm -rf /data/adb/modules*/asoul_affinity_opt 131 | echo "- 正在为您安装asopt" 132 | magisk --install-module "$MODULE_PATH"/modules/asoulopt.zip 133 | fi 134 | rm -rf "$MODULE_PATH"/modules/asoulopt.zip 135 | } 136 | 137 | fix_module_prop() { 138 | mkdir -p /data/adb/modules/uperf/ 139 | cp -f "$MODULE_PATH/module.prop" /data/adb/modules/uperf/module.prop 140 | } 141 | 142 | unlock_limit(){ 143 | if [[ ! -d $MODPATH/system/vendor/etc/perf/ ]];then 144 | dir=$MODPATH/system/vendor/etc/perf/ 145 | mkdir -p $dir 146 | fi 147 | 148 | for i in ` ls /system/vendor/etc/perf/ ` 149 | do 150 | touch $dir/$i 151 | done 152 | } 153 | 154 | echo "" 155 | echo "* 原模块地址 Uperf https://github.com/yc9559/uperf/" 156 | echo "* Author: Matt Yang ❤️吟惋兮❤️改" 157 | echo "* Version: Game Turbo1.31 based on uperf904" 158 | echo "* 请不要破坏Uperf运行环境" 159 | echo "* 模块会附带安装asopt" 160 | echo "* " 161 | echo "* 极速模式请自备散热,删除温控体验更佳" 162 | echo "* 本模块与限频模块、部分优化模块冲突" 163 | echo "* 模块可能与第三方内核冲突" 164 | echo "* 请自行事先询问内核作者" 165 | echo "* 请不要破坏Uperf Game Turbo运行环境!!!" 166 | echo "* 请不要自行更改/切换CPU调速器!!!" 167 | echo "* " 168 | echo "* dnmd.leijun.MIUI.jinfan😅" 169 | echo "* WoShaNiMa.OnePlus.ColorOS.nimasile😅" 170 | echo "* " 171 | echo "* ❤️吟惋兮❤️" 172 | echo "- 正在为您安装Uperf Game Turbo❤️" 173 | install_uperf 174 | #unlock_limit 175 | echo "* Uperf Game Turbo安装成功❤️" 176 | #install_corp 177 | check_asopt 178 | echo "* asopt安装成功❤️" 179 | echo "* 重启即可" 180 | echo "* 欢迎使用Uperf Game Turbo" 181 | echo "* 祝体验愉快" 182 | fix_module_prop -------------------------------------------------------------------------------- /magisk/system.prop: -------------------------------------------------------------------------------- 1 | ro.mtk_perf_simple_start_win=0 2 | ro.mtk_perf_response_time=0 3 | ro.mtk_perf_fast_start_win=0 4 | -------------------------------------------------------------------------------- /magisk/system/vendor/etc/power_app_cfg.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /magisk/system/vendor/etc/powercontable.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | more 6 | 6553599 7 | 1 8 | 130 9 | 10 | 11 | 12 | more 13 | 1 14 | 0 15 | 1 16 | CAM^ 17 | 1 18 | 19 | 20 | 21 | more 22 | 100 23 | 0 24 | 60 25 | eas_boost^ 26 | 27 | 28 | 29 | more 30 | 2000000000 31 | -1 32 | 798 33 | 34 | 35 | 36 | more 37 | 25855 38 | 0 39 | 4 40 | 41 | 42 | -------------------------------------------------------------------------------- /magisk/system/vendor/etc/powerscntbl.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /magisk/system/vendor/lib64/libthermalclient.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinwanxi/Uperf-Game-Turbo/298d3d6bd272102105fc837fa92ffed9ee10dd20/magisk/system/vendor/lib64/libthermalclient.so -------------------------------------------------------------------------------- /magisk/uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # MR author: railjty 19 | USER_PATH=/sdcard/Android/yc/uperf 20 | 21 | wait_until_login() { 22 | # in case of /data encryption is disabled 23 | while [ "$(getprop sys.boot_completed)" != "1" ]; do 24 | sleep 1 25 | done 26 | 27 | # we doesn't have the permission to rw "/sdcard" before the user unlocks the screen 28 | local test_file="/sdcard/Android/.PERMISSION_TEST" 29 | true >"$test_file" 30 | while [ ! -f "$test_file" ]; do 31 | true >"$test_file" 32 | sleep 1 33 | done 34 | rm "$test_file" 35 | } 36 | 37 | on_remove() { 38 | wait_until_login 39 | 40 | # keep user perapp config 41 | cp -af $USER_PATH/perapp_powermode.txt /sdcard/ 42 | rm -rf $USER_PATH 43 | mkdir -p $USER_PATH 44 | mv /sdcard/perapp_powermode.txt $USER_PATH/ 45 | 46 | rm -f /data/powercfg* 47 | } 48 | 49 | # do not block boot 50 | (on_remove &) 51 | -------------------------------------------------------------------------------- /magisk/vtools_powercfg.sh: -------------------------------------------------------------------------------- 1 | #!/vendor/bin/sh 2 | # 3 | # Copyright (C) 2021-2022 Matt Yang 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # powercfg wrapper for com.omarea.vtools 19 | # MAKE SURE THAT THE MAGISK MODULE "Uperf" HAS BEEN INSTALLED 20 | -------------------------------------------------------------------------------- /media/adjusted_demand_capacity_relation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinwanxi/Uperf-Game-Turbo/298d3d6bd272102105fc837fa92ffed9ee10dd20/media/adjusted_demand_capacity_relation.png -------------------------------------------------------------------------------- /media/alipay-qr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinwanxi/Uperf-Game-Turbo/298d3d6bd272102105fc837fa92ffed9ee10dd20/media/alipay-qr.png -------------------------------------------------------------------------------- /media/android_am.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinwanxi/Uperf-Game-Turbo/298d3d6bd272102105fc837fa92ffed9ee10dd20/media/android_am.png -------------------------------------------------------------------------------- /media/fingerprint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinwanxi/Uperf-Game-Turbo/298d3d6bd272102105fc837fa92ffed9ee10dd20/media/fingerprint.png -------------------------------------------------------------------------------- /media/render_restart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinwanxi/Uperf-Game-Turbo/298d3d6bd272102105fc837fa92ffed9ee10dd20/media/render_restart.png -------------------------------------------------------------------------------- /media/render_stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinwanxi/Uperf-Game-Turbo/298d3d6bd272102105fc837fa92ffed9ee10dd20/media/render_stop.png -------------------------------------------------------------------------------- /media/sflag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinwanxi/Uperf-Game-Turbo/298d3d6bd272102105fc837fa92ffed9ee10dd20/media/sflag.png -------------------------------------------------------------------------------- /media/wechat_resume.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinwanxi/Uperf-Game-Turbo/298d3d6bd272102105fc837fa92ffed9ee10dd20/media/wechat_resume.png -------------------------------------------------------------------------------- /version.json: -------------------------------------------------------------------------------- 1 | { 2 | "versionCode": 250410, 3 | "version": "1.43 based on uperf 904", 4 | "zipUrl": "https://github.com/yinwanxi/Uperf-Game-Turbo/releases/download/Uperf-Game-Turbo.1.43/Uperf_Game_Turbo-1.43.zip", 5 | "changelog": "https://raw.githubusercontent.com/yinwanxi/Uperf-Game-Turbo/master/changelog.md" 6 | } 7 | --------------------------------------------------------------------------------