feat: CPU 型号自动识别 + 同级对比动态标记;清理无用依赖
This commit is contained in:
1 parent
3ab8487db3
commit
62bf2e7e30
3 files changed
+45
-17
No files matched your search
@@ -79,25 +79,55 @@ def get_cpu_stats():
|
||||
stats['threads'] = 0
|
||||
stats['sockets'] = 0
|
||||
|
||||
# Benchmark data (hardcoded known scores for this CPU)
|
||||
stats['bench'] = {
|
||||
'passmark_single': 1850,
|
||||
'passmark_multi': 5500,
|
||||
'cinebench_r23_single': 850,
|
||||
'cinebench_r23_multi': 3200,
|
||||
'geekbench6_single': 1100,
|
||||
'geekbench6_multi': 3500,
|
||||
# CPU benchmark database — matches by model_short substring
|
||||
CPU_DB = {
|
||||
'i3-9100T': {
|
||||
'bench': {'passmark_single': 1850, 'passmark_multi': 5500, 'cinebench_r23_single': 850, 'cinebench_r23_multi': 3200, 'geekbench6_single': 1100, 'geekbench6_multi': 3500},
|
||||
'tdp': 35,
|
||||
},
|
||||
'i5-8600T': {
|
||||
'bench': {'passmark_single': 2034, 'passmark_multi': 10870, 'cinebench_r23_single': 1050, 'cinebench_r23_multi': 5500, 'geekbench6_single': 1400, 'geekbench6_multi': 5500},
|
||||
'tdp': 35,
|
||||
},
|
||||
'i5-8400T': {
|
||||
'bench': {'passmark_single': 1930, 'passmark_multi': 8500, 'cinebench_r23_single': 950, 'cinebench_r23_multi': 4200, 'geekbench6_single': 1300, 'geekbench6_multi': 4300},
|
||||
'tdp': 35,
|
||||
},
|
||||
'i5-10500T': {
|
||||
'bench': {'passmark_single': 2300, 'passmark_multi': 10800, 'cinebench_r23_single': 1100, 'cinebench_r23_multi': 5800, 'geekbench6_single': 1500, 'geekbench6_multi': 6000},
|
||||
'tdp': 35,
|
||||
},
|
||||
}
|
||||
|
||||
cpu_model_name = stats.get('model_short', '')
|
||||
matched = None
|
||||
for key, data in CPU_DB.items():
|
||||
if key.lower() in cpu_model_name.lower():
|
||||
matched = key
|
||||
stats['bench'] = data['bench']
|
||||
stats['current_tdp'] = data['tdp']
|
||||
break
|
||||
if not matched:
|
||||
# fallback: safe defaults
|
||||
stats['bench'] = {'passmark_single': 0, 'passmark_multi': 0, 'cinebench_r23_single': 0, 'cinebench_r23_multi': 0, 'geekbench6_single': 0, 'geekbench6_multi': 0}
|
||||
stats['current_tdp'] = 0
|
||||
|
||||
# Comparison: nearby CPUs
|
||||
stats['compare'] = [
|
||||
compare_list = [
|
||||
{'name': 'N100', 'score': 4200, 'tdp': 6, 'note': '入门NAS神U'},
|
||||
{'name': 'J4125', 'score': 2800, 'tdp': 10, 'note': '极低功耗'},
|
||||
{'name': 'i3-9100T ←你', 'score': 5500, 'tdp': 35, 'note': '35W均衡'},
|
||||
{'name': 'i5-8400T', 'score': 8500, 'tdp': 35, 'note': '35W升级首选'},
|
||||
{'name': 'i5-10500T', 'score': 10800, 'tdp': 35, 'note': '6C/12T'},
|
||||
{'name': 'i3-12100', 'score': 12400, 'tdp': 60, 'note': '质变之选'},
|
||||
{'name': 'i5-10500T', 'score': 10800, 'tdp': 35, 'note': '6C/12T'},
|
||||
{'name': 'i5-8600T', 'score': 10870, 'tdp': 35, 'note': '6C/12T'},
|
||||
{'name': 'i5-8400T', 'score': 8500, 'tdp': 35, 'note': '35W升级'},
|
||||
{'name': 'i3-9100T', 'score': 5500, 'tdp': 35, 'note': '35W均衡'},
|
||||
]
|
||||
# Mark the matched CPU
|
||||
for c in compare_list:
|
||||
if matched and c['name'] == matched:
|
||||
c['name'] = f"{c['name']} ←你"
|
||||
break
|
||||
stats['compare'] = compare_list
|
||||
|
||||
# Overclock check
|
||||
cur_freq = int(read_sysfs(f'{SYSFS_CPU}/cpu0/cpufreq/scaling_cur_freq', '0')) // 1000
|
||||
|
||||
Reference in new issue
Block a user