-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathindex.html
More file actions
433 lines (385 loc) · 15.7 KB
/
Copy pathindex.html
File metadata and controls
433 lines (385 loc) · 15.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>线程优化模块使用说明与下载</title>
<style>
:root {
--primary: #3498db;
--secondary: #2c3e50;
--accent: #e74c3c;
--light-bg: #f8f9fa;
--success: #2ecc71;
--warning: #f39c12;
--card-gradient: linear-gradient(145deg, #ffffff, #f5f7fa);
--header-gradient: linear-gradient(135deg, #2c3e50, #4a6491);
--download-gradient: linear-gradient(135deg, #e8f5e9, #c8e6c9);
--example-gradient: linear-gradient(135deg, #f0f8ff, #e1f5fe);
}
body {
font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
line-height: 1.6;
max-width: 800px;
margin: 20px auto;
padding: 0 20px;
background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
background-attachment: fixed;
color: #333;
}
h1 {
color: white;
font-size: 1.8rem;
padding: 15px 20px;
border-radius: 10px;
background: var(--header-gradient);
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
margin: 25px 0;
}
h2 {
color: var(--secondary);
border-bottom: 2px solid var(--primary);
font-size: 1.4rem;
margin-top: 1.8em;
padding-bottom: 8px;
scroll-margin-top: 20px;
}
h3 {
color: #5d6d7e;
font-size: 1.1rem;
margin-top: 1.2em;
}
.synopsis, .toc, .example, .summary, .download, .code {
background: var(--card-gradient);
padding: 15px 20px;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
margin: 20px 0;
}
.synopsis {
border-left: 4px solid var(--primary);
}
.code {
font-family: 'Fira Code', Consolas, monospace;
overflow-x: auto;
border: 1px solid #e0e0e0;
background: var(--light-bg);
box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
font-size: 50%;
}
.example {
background: var(--example-gradient);
border-left: 4px solid var(--primary);
border-radius: 0 8px 8px 0;
}
.warning {
color: var(--accent);
font-weight: 600;
}
.download {
background: var(--download-gradient);
text-align: center;
border: 1px solid #c8e6c9;
}
.summary {
text-align: center;
border: 1px dashed var(--primary);
}
.core-representation {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin: 15px 0;
}
.core-item {
background: white;
padding: 10px;
border-radius: 8px;
flex: 1;
min-width: 120px;
text-align: center;
border-top: 3px solid var(--primary);
font-size: 0.9rem;
border: 1px solid #e0e0e0;
}
.core-item strong {
font-size: 1.1rem;
display: block;
margin-bottom: 5px;
}
img {
max-width: 100%;
height: auto;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
display: block;
margin: 15px auto;
background: white;
padding: 5px;
}
a {
color: var(--primary);
text-decoration: none;
font-weight: 500;
transition: all 0.2s;
}
a:hover {
color: var(--accent);
text-decoration: underline;
}
.qr-code {
max-width: 200px;
margin: 15px auto;
display: block;
}
.btn-download {
display: inline-block;
background: linear-gradient(135deg, var(--primary), #2980b9);
color: white;
padding: 12px 30px;
border-radius: 30px;
font-weight: bold;
margin: 15px 0;
box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
transition: all 0.3s;
min-width: 180px;
min-height: 44px;
box-sizing: border-box;
text-align: center;
}
.btn-download:hover {
transform: translateY(-3px);
box-shadow: 0 6px 15px rgba(52, 152, 219, 0.4);
}
.toc {
padding: 12px 15px;
margin: 20px auto;
}
.toc h3 {
margin-top: 0;
color: var(--secondary);
border-bottom: 1px solid #eee;
padding-bottom: 10px;
text-align: center;
font-size: 1.2rem;
}
.toc ul {
padding-left: 0;
list-style-type: none;
display: flex;
flex-wrap: wrap;
gap: 10px;
margin: 0;
justify-content: center;
}
.toc li {
margin: 0;
flex: 1;
min-width: 120px;
}
.toc a {
display: block;
padding: 8px 12px;
background: rgba(220, 220, 220, 0.5);
border-radius: 6px;
transition: all 0.2s;
color: #5d6d7e;
text-align: center;
}
.toc a:hover {
background: rgba(52, 152, 219, 0.2);
color: var(--primary);
}
.back-to-top {
display: block;
text-align: right;
margin-top: 20px;
font-size: 0.9rem;
}
@media (max-width: 767px) {
.toc ul {
flex-direction: row;
gap: 8px;
}
.toc li {
min-width: calc(50% - 5px);
flex: 0 0 calc(50% - 5px);
}
}
@media (max-width: 480px) {
body {
margin: 10px auto;
padding: 0 15px;
}
h1 {
font-size: 1.5rem;
padding: 12px 15px;
margin: 15px 0;
}
.code {
font-size: 0.9rem;
padding: 12px;
}
.toc {
padding: 10px 12px;
margin: 15px 0;
}
.btn-download {
min-width: 160px;
padding: 10px 20px;
min-height: 42px;
font-size: 0.9rem;
}
.core-item {
min-width: 100px;
padding: 8px;
font-size: 0.85rem;
}
.core-item strong {
font-size: 1rem;
}
h2 {
font-size: 1.3rem;
}
}
</style>
</head>
<body>
<h1>线程优化模块使用说明</h1>
<div class="synopsis">
<p>一个使用纯C语言编写,支持定义规则的安卓应用与游戏线程优化程序</p>
</div>
<!-- 目录导航 -->
<div class="toc">
<h3>📚内容导航</h3>
<ul>
<li><a href="#concept">核心概念与配置</a></li>
<li><a href="#rules">规则解析与示例</a></li>
<li><a href="#cpu">CPU范围表示法</a></li>
<li><a href="#wildcard">通配符高级用法</a></li>
<li><a href="#guide">规则的编写指南</a></li>
<li><a href="#verification">优化验证与调试</a></li>
<li><a href="#download">⏬资源下载</a></li>
</ul>
</div>
<h2 id="concept">一、核心概念与配置</h2>
<h3>1. 配置文件路径</h3>
<div class="code">/data/adb/modules/AppOpt/applist.conf</div>
<h3>2. 处理器架构示例(以高通骁龙888八核处理器为例)</h3>
<div class="example">
<p>采用了4+3+1核心设计:</p>
<div class="core-representation">
<div class="core-item">
<strong>0-3</strong>
<p>四颗A55小核(能效核心)</p>
</div>
<div class="core-item">
<strong>4-6</strong>
<p>三颗A78中核(性能核心)</p>
</div>
<div class="core-item">
<strong>7</strong>
<p>一颗X1大核(高性能核心)</p>
</div>
<div class="core-item">
<strong>0-7</strong>
<p>全部核心</p>
</div>
</div>
</div>
<h2 id="rules">二、规则解析与示例</h2>
<div class="example">
<h3>示例1 进程级规则:应用包名=核心范围</h3>
<div class="code">com.tencent.tmgp.sgame=4-7</div>
<p>将王者荣耀所有线程绑定到CPU4-7(性能核心)</p>
</div>
<div class="example">
<h3>示例2 线程级规则:应用包名{线程名}=核心范围</h3>
<div class="code">com.tencent.tmgp.sgame{UnityMain}=7</div>
<p>精准绑定王者荣耀的UnityMain线程到超大核心7</p>
</div>
<h2 id="cpu">三、CPU核心范围表示法</h2>
<div class="code">
<ul>
<li><span class="warning">4-7</span> ➔ 4到7(CPU4,5,6,7)</li>
<li><span class="warning">4,7</span> ➔ 4与7(CPU4,7)</li>
<li><span class="warning">0-3,7</span> ➔ 0到3与7(CPU0,1,2,3,7)</li>
</ul>
</div>
<h2 id="wildcard">四、通配符高级用法</h2>
<div class="example">
<div class="code">com.tencent.tmgp.sgame{Unity*}=6-7</div>
<p>用 <span class="warning">*</span> 号匹配所有<span class="warning">Unity</span>开头的线程(如<span class="warning">Unity</span>Main、<span class="warning">Unity</span>GfxDeviceW)</p>
<div class="code">com.example.app{*Main}=4-6</div>
<p>或者匹配所有以<span class="warning">Main</span>结尾的线程(Unity<span class="warning">Main</span>)</p>
<div class="code">com.example.app{Job.worker [1-2]}=4-6</div>
<p>用 <span class="warning">[1-2]</span> 来匹配名为Job.worker <span class="warning">1</span>与Job.worker <span class="warning">2</span>的线程</p>
<div class="code">com.example.app{Thread-[0-9]*}=4-6</div>
<p>结合 <span class="warning">[0-9]</span> 与 <span class="warning">*</span> 来匹配Thread-开头,且后一位为数字的线程,例如Thread-<span class="warning">123</span>、Thread-<span class="warning">0abc</span></p>
<div class="code">com.example.app{Thread-?}=0-3</div>
<p>用一个英文问号 <span class="warning">?</span> 来匹配Thread-开头后面为一个字符的线程,例如Thread-<span class="warning">1</span>、Thread-<span class="warning">a</span></p>
<div class="code">com.example.app{Thread-??}=0-3</div>
<p>也可以用两个 <span class="warning">??</span> 则可以匹配两个字符,例如Thread-<span class="warning">12</span>、Thread-<span class="warning">ab</span>、Thread-<span class="warning">1a</span>以此类推</p>
</div>
<h2 id="guide">五、规则编写指南</h2>
<ol>
<li>线程分配应该遵循高占用线程优先分配性能核心,中/低占用分配到中/小核心簇,避免线程间争抢资源。</li>
<li>单个线程在任意时刻只能在一个CPU核心上执行指令,其指令流具有顺序性和依赖性,无法被拆分到多个核心并行处理。</li>
<li>线程级规则优先级高于进程级。</li>
</ol>
<div class="example">
<h3>王者荣耀优化示例</h3>
<p>例如我手机CPU为高通骁龙8 Elite,采用了6+2核心设计,有六颗中核(0-5)与两颗高性能大核(6-7),而王者荣耀UnityMain与UnityGfxDeviceW两个线程CPU占用是最大的,那么我可以将优化规则写为</p>
<div class="code">com.tencent.tmgp.sgame{Unity*}=6-7</div>
<div class="code">com.tencent.tmgp.sgame=0-5</div>
<p>它表示将Unity开头的两个高占用线程绑定到高性能大核,其它线程绑定到0-5。</p>
<div style="text-align: center; margin: 20px 0;">
<img src="http://appopt.suto.top/GameExample.jpg" alt="性能监测示意图" style="max-width: 90%;">
</div>
</div>
<div class="example">
<h3>FTP应用优化示例</h3>
<div class="code">com.ftpshare=4-7</div>
<p>例如我手机上有一个FTP共享文件的应用,它的优化不太好,老是跑在小核心上,导致文件共享的速度不够快,那么我为它添加上述规则,就可以提升文件共享速度了。</p>
</div>
<div class="example">
<h3>游戏应用优化逻辑</h3>
<p>依旧用王者荣耀举例。假设当前设备是4+3+1核心设计的CPU,我们可以将最高负载的一个线程放超大核7,中等负载放中核4-6,低负载0-6。</p>
<p>可以得出以下4条规则:</p>
<div class="code">com.tencent.tmgp.sgame{UnityMain}=7</div>
<div class="code">com.tencent.tmgp.sgame{UnityGfxDeviceW}=4-6</div>
<div class="code">com.tencent.tmgp.sgame{Job.worker*}=4-6</div>
<div class="code">com.tencent.tmgp.sgame=0-6</div>
<p>将这4条规则保存到applist.conf中即可</p>
</div>
<h2 id="verification">六、优化验证与调试</h2>
<div class="example">
<p>推荐工具:</p>
<ul>
<li><code>Scene8</code> 中的线程监视器</li>
<li>其它类似的性能分析工具</li>
</ul>
<p>验证步骤:</p>
<ol>
<li>观察每个线程CPU核心占用后为其合理分配核心</li>
<li>这条规则实际性能优化表现(帧率/延迟)</li>
<li>合理的线程规划可以让游戏帧率更稳定的同时功耗更低</li>
</ol>
</div>
<div class="summary">
<p>💡 聪明的你现在已经学会如何使用线程优化模块,并举一反三优化你的应用与游戏了</p>
</div>
<h2 id="download">资源下载</h2>
<div class="download">
<strong>Magisk模块下载:</strong><br>
<a href="https://gitee.com/sutoliu/AppOpt/tree/master/modules_update" target="_blank" class="btn-download">Gitee</a><br>
<a href="https://hito.lanzouo.com/b0cm2g3hi" target="_blank" class="btn-download">蓝奏云</a><br>
密码:<span class="warning">suto</span>
</div>
<div class="download">
<strong>请作者喝杯奶茶</strong><br>
<a href="https://qr.alipay.com/tsx183072iwa3igjxm5fjb6" target="_blank" class="btn-download">打开支付宝</a><br>
<img src="http://appopt.suto.top/%E8%AF%B7%E4%BD%9C%E8%80%85%E6%9D%AF%E5%A5%B6%E8%8C%B6.png" alt="二维码" class="qr-code">
</div>
</body>
</html>