diff --git a/app.py b/app.py index b8b4645..908922f 100644 --- a/app.py +++ b/app.py @@ -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 diff --git a/requirements.txt b/requirements.txt index 20d5a1b..9cadc75 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,2 @@ Flask psutil -Flask-SSE -pandas diff --git a/static/index.html b/static/index.html index 00b76e5..a2faf55 100644 --- a/static/index.html +++ b/static/index.html @@ -654,12 +654,12 @@ function updateCPU(data) { } // Comparison chart if (d.compare) { - const your = d.compare.find(c => c.name.includes('9100T')); - const myScore = your ? your.score : d.bench ? d.bench.passmark_multi : 5500; + const your = d.compare.find(c => c.name.includes('←你')); + const myScore = your ? your.score : (d.bench ? d.bench.passmark_multi : 5500); const maxScore = Math.max(...d.compare.map(c => c.score), 1); document.getElementById('compareChart').innerHTML = d.compare.map(c => { const pct = Math.round(c.score / maxScore * 100); - const isMe = c.name.includes('9100T'); + const isMe = c.name.includes('←你'); const barColor = isMe ? 'var(--accent)' : 'var(--card-border)'; return `