Skip to content

Commit 56ce137

Browse files
author
reigadegr
committed
rename: only6全部改名dualo (dual + opt)同时恢复至老策略;更新201版本; 优化安装脚本
1 parent 9da166a commit 56ce137

File tree

18 files changed

+72
-71
lines changed

18 files changed

+72
-71
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thread-opt"
3-
version = "2.0.0"
3+
version = "2.0.1"
44
edition = "2024"
55
description = "The Hard Affinity policy binds threads to target cores in gaming."
66
authors = ["reigadegr"]

module/changelog.md

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,11 @@
1+
# 本次更新为小版本更新
12
## 🚀 性能优化(perf)
2-
3-
- **性能深度调优**
4-
▸ 采用 `HashSet` 替代部分 `Vec` 容器
5-
▸ 实现 O(1) 时间复杂度,集合操作性能提升
6-
▸ 引入`task_map`缓存机制,开销低到没朋友!
7-
8-
- **内存存储革新**
9-
▸ config部分替换 `Vec``Box` 容器
10-
▸ 内存布局更加紧凑,减少空间浪费
3+
- 优化编译参数,降低200kb体积
4+
- 移除无用的get_tid_list函数
115

126
## ✨ 功能迭代(feat)
13-
- **智能安装系统**
14-
✅ 自动创建初始化备份快照(/storage/emulated/0/Android/thread_opt.toml)
15-
16-
- **硬件适配扩展**
17-
� 新增骁龙8系7核处理器支持
18-
19-
- **配置自治系统**
20-
⚡ 启动时自动格式化 `thread_opt.toml`
7+
- 覆盖更新配置文件,添加了一个字段修改了一个字段,同时自动备份原有文件
8+
- 修复cf卡死
219

2210
## ⚙️ 架构治理(chore)
23-
24-
- **调度标准化**
25-
🎛️ 全平台 Only6 策略统一
26-
27-
**演进策略优先级**
28-
1️⃣ 基础架构优化 → 2️⃣ 硬件兼容扩展 → 3️⃣ 跨平台标准推进
11+
- Only6改成Dualo字段,意为多大核优化,(8e特调)

module/customize.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
echo "Hello World!"
33
if [ ! -f /storage/emulated/0/Android/thread_opt.toml ]; then
44
cp $MODPATH/thread_opt.toml /storage/emulated/0/Android/thread_opt.toml
5-
ln -s /storage/emulated/0/Android/thread_opt.toml $MODPATH/thread_opt.toml
6-
rm $MODPATH/thread_opt.toml
75
fi
6+
7+
time=$(date "+%Y-%m-%d_%H:%M:%S")
8+
cp -af /storage/emulated/0/Android/thread_opt.toml /storage/emulated/0/Android/thread_opt_"$time"backup.toml
9+
cp -f $MODPATH/thread_opt.toml /storage/emulated/0/Android/thread_opt.toml
10+
811
echo "仓库地址: https://github.com/reigadegr/thread-opt"
912
echo "适配游戏请截屏Scene帧率统计图 && 线程负载统计图"
1013
echo "同时附上包名提交到仓库的issue处"

module/module.prop

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
id=thread_opt
22
name=Thread-opt
3-
version=v2.0.0
4-
versionCode=200
3+
version=v2.0.1
4+
versionCode=201
55
author=Nigger
66
description=The Hard Affinity policy binds threads to target cores in gaming.
77
updateJson=https://github.com/reigadegr/thread-opt/raw/dev/module/update.json

module/thread_opt.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ packages = [
1616
]
1717
[comm_match.policy]
1818
top = []
19-
only6 = ["UnityGfx"]
19+
dualo = ["UnityGfx"]
2020
only7 = ["UnityMain"]
2121
middle = ["Thread-", "Job.Worker"]
2222
mono = []
@@ -27,7 +27,7 @@ background = []
2727
packages = ["com.kurogame.mingchao"]
2828
[comm_match.policy]
2929
top = ["Pool"]
30-
only6 = ["RHIThread"]
30+
dualo = ["RHIThread"]
3131
only7 = ["GameThread"]
3232
middle = ["RenderThread"]
3333
mono = []
@@ -38,7 +38,7 @@ background = []
3838
packages = ["com.netease.sky"]
3939
[comm_match.policy]
4040
top = []
41-
only6 = []
41+
dualo = []
4242
only7 = ["MainThread"]
4343
middle = []
4444
mono = ["JobThread"]
@@ -51,7 +51,7 @@ max_comm = ["GLThread"]
5151
max_comm_core = "Only7"
5252
[usage_top1.policy]
5353
top = []
54-
only6 = []
54+
dualo = []
5555
only7 = []
5656
middle = []
5757
mono = []
@@ -64,7 +64,7 @@ max_comm = ["Thread-"]
6464
max_comm_core = "Only7"
6565
[usage_top1.policy]
6666
top = []
67-
only6 = ["._RuMain"]
67+
dualo = ["._RuMain"]
6868
only7 = []
6969
middle = ["mail-cmar"]
7070
mono = []
@@ -77,7 +77,7 @@ max_comm = ["Thread-"]
7777
max_comm_core = "Only7"
7878
[usage_top1.policy]
7979
top = ["FAsync"]
80-
only6 = ["RHIThread"]
80+
dualo = ["RHIThread"]
8181
only7 = []
8282
middle = ["RenderThread"]
8383
mono = []
@@ -90,7 +90,7 @@ max_comm = ["GameThread"]
9090
max_comm_core = "Only7"
9191
[usage_top1.policy]
9292
top = []
93-
only6 = ["RHIThread"]
93+
dualo = ["RHIThread"]
9494
only7 = []
9595
middle = ["RenderThread"]
9696
mono = []
@@ -103,7 +103,7 @@ max_comm = ["UnityMain"]
103103
max_comm_core = "Only7"
104104
[usage_top1.policy]
105105
top = []
106-
only6 = ["UnityGfx"]
106+
dualo = ["UnityGfx"]
107107
only7 = []
108108
middle = []
109109
mono = []
@@ -113,10 +113,10 @@ background = ["Thread-"]
113113
[[usage_top1]]
114114
packages = ["com.tencent.lolm", "com.tencent.tmgp.speedmobile"]
115115
max_comm = ["Thread-"]
116-
max_comm_core = "Only6"
116+
max_comm_core = "Dualo"
117117
[usage_top1.policy]
118118
top = []
119-
only6 = []
119+
dualo = []
120120
only7 = ["UnityMain"]
121121
middle = []
122122
mono = []
@@ -126,10 +126,10 @@ background = ["Thread-"]
126126
[[usage_top1]]
127127
packages = ["com.activision.callofduty.warzone"]
128128
max_comm = ["Thread-"]
129-
max_comm_core = "Only6"
129+
max_comm_core = "Dualo"
130130
[usage_top1.policy]
131131
top = []
132-
only6 = []
132+
dualo = []
133133
only7 = ["WZM_Main"]
134134
middle = ["Worker"]
135135
mono = []

module/update.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"versionCode": 200,
3-
"version": "2.0.0",
4-
"zipUrl": "https://github.com/reigadegr/thread-opt/releases/download/v2.0.0/thread-opt_release.zip",
2+
"versionCode": 201,
3+
"version": "2.0.1",
4+
"zipUrl": "https://github.com/reigadegr/thread-opt/releases/download/v2.0.1/thread-opt_release.zip",
55
"changelog": "https://github.com/reigadegr/thread-opt/raw/dev/module/changelog.md"
66
}

src/config/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub struct Policy {
5757
#[serde(deserialize_with = "deserialize_byte_array")]
5858
pub top: Box<[ByteArray]>,
5959
#[serde(deserialize_with = "deserialize_byte_array")]
60-
pub only6: Box<[ByteArray]>,
60+
pub dualo: Box<[ByteArray]>,
6161
#[serde(deserialize_with = "deserialize_byte_array")]
6262
pub only7: Box<[ByteArray]>,
6363
#[serde(deserialize_with = "deserialize_byte_array")]

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pub unsafe extern "C" fn affinity_setting_worker(argc: c_int, argv: *const *cons
3232

3333
for arg in args {
3434
if let Ok(s) = unsafe { CStr::from_ptr(*arg) }.to_str() {
35+
#[cfg(debug_assertions)]
3536
log::info!("命令行参数{s}");
3637
}
3738
}

src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ unsafe extern "C" fn main(argc: c_int, argv: *const *const c_char) {
3232

3333
for arg in args {
3434
if let Ok(s) = unsafe { CStr::from_ptr(*arg) }.to_str() {
35+
#[cfg(debug_assertions)]
3536
log::info!("命令行参数{s}");
3637
}
3738
}

src/policy/affinity_policy.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::{
22
cgroup::group_info::{get_background_group, get_middle_group, get_top_group},
33
utils::affinity_utils::global_cpu_utils::{
44
bind_list_to_middle, bind_list_to_middle_background, bind_tid_to_background,
5-
bind_tid_to_middle, bind_tid_to_only6, bind_tid_to_only7, bind_tid_to_top,
5+
bind_tid_to_dualo, bind_tid_to_middle, bind_tid_to_only7, bind_tid_to_top,
66
bind_tid_to_zero_six,
77
},
88
};
@@ -17,7 +17,13 @@ static ONLY7_POLICY_FN: Lazy<fn(pid_t)> = Lazy::new(|| {
1717
}
1818
});
1919

20-
static ONLY6_POLICY_FN: Lazy<fn(pid_t)> = Lazy::new(|| bind_tid_to_only6);
20+
static ONLY6_POLICY_FN: Lazy<fn(pid_t)> = Lazy::new(|| {
21+
if get_middle_group() == get_background_group() {
22+
bind_tid_to_dualo
23+
} else {
24+
bind_tid_to_middle
25+
}
26+
});
2127

2228
static ZERO_SIX_POLICY_FN: Lazy<fn(pid_t)> = Lazy::new(|| {
2329
if get_top_group() == [6, 7] {
@@ -41,7 +47,7 @@ pub fn top_policy(tid: pid_t) {
4147
bind_tid_to_top(tid);
4248
}
4349

44-
pub fn only6_policy(tid: pid_t) {
50+
pub fn dualo_policy(tid: pid_t) {
4551
ONLY6_POLICY_FN(tid);
4652
}
4753

0 commit comments

Comments
 (0)