feat(monitor): CPU 卡加温度和功耗——走 MSI Afterburner 的共享内存(MAHMSharedMemory):Windows 上免驱动的唯一口子(psutil 不支持、ACPI 热区只有板温、Power Meter 无实例);实测 CPU 98-100 °C / 222-227 W,用 GPU1 power 对 nvidia-smi 校准过(125.29 vs 124.57);数据比 10 秒旧就当读不到、Afterburner 没开就自动隐藏这两行;28 核条悬停可看每核温度

This commit is contained in:
cbb
2026-10-18 17:31:05 +08:00
parent b1cf4126fd
commit faf6dd2748
2 changed files with 55 additions and 3 deletions
+6 -2
View File
@@ -557,13 +557,17 @@ function renderStatus(s) {
}).join(hr) : '';
const cpuBlk = CP.n ? (() => {
const tot = CP.total ?? 0, C = 2 * Math.PI * 50, col = tot > 85 ? css('--bad') : tot > 60 ? css('--warn') : css('--ok');
const bars = (CP.per || []).map((v, i) => `<div title="核 ${i + 1}: ${v}%" style="flex:1;min-width:0;height:100%;border-radius:2px;background:${v > 85 ? css('--bad') : v > 60 ? css('--warn') : css('--accent2')};opacity:${0.18 + 0.82 * Math.min(1, v / 100)}"></div>`).join('');
const ct = CP.coreT || [], ctMax = ct.length ? Math.max(...ct) : null;
const tcol = v => v > 98 ? css('--bad') : v > 90 ? css('--warn') : css('--c6');
const bars = (CP.per || []).map((v, i) => `<div title="核 ${i + 1}: ${v}%${ct[i] != null ? ' · ' + ct[i] + ' °C' : ''}" style="flex:1;min-width:0;height:100%;border-radius:2px;background:${v > 85 ? css('--bad') : v > 60 ? css('--warn') : css('--accent2')};opacity:${0.18 + 0.82 * Math.min(1, v / 100)}"></div>`).join('');
return `<div class="gpuwrap"><div class="ring"><svg width="116" height="116"><circle cx="58" cy="58" r="50" stroke="#1b2433" stroke-width="10" fill="none"/>
<circle cx="58" cy="58" r="50" stroke="${col}" stroke-width="10" fill="none" stroke-linecap="round" stroke-dasharray="${C}" stroke-dashoffset="${C * (1 - tot / 100)}" style="transition:stroke-dashoffset .6s"/></svg>
<div class="c"><div><b>${tot}%</b><span>CPU</span></div></div></div>
<div class="gpurows">${gr('占用', `${tot}% · ${CP.n} 核`, tot, col)}
${CP.temp != null ? gr('温度', `${CP.temp} °C${ctMax != null && ctMax !== CP.temp ? `(最高核 ${ctMax})` : ''}`, CP.temp, tcol(CP.temp), 'MSI Afterburner 的共享内存;鼠标停在核条上还能看每核温度') : ''}
${CP.power != null ? gr('功耗', `${Math.round(CP.power)} W`, 100 * CP.power / 253, css('--c7'), 'CPU 封装功耗(满标度按 14700K 的 PL2 253 W 画)') : ''}
<div class="cores">${bars}</div></div></div>
<div class="gname">${CP.model || 'CPU'} · 每核占用(深色=忙)</div>`;
<div class="gname">${CP.model || 'CPU'}${CP.temp == null ? ' · 开 MSI Afterburner 才能读 CPU 温度/功耗' : ''} · 每核占用(深色=忙)</div>`;
})() : '';
$('gpu').innerHTML = (gpuBlk + (gpuBlk && cpuBlk ? hr : '') + cpuBlk) || empty('未检测到 nvidia-smi / psutil');