新增 显存占用显示功能;

This commit is contained in:
2025-09-11 21:39:05 +08:00
parent 8732d67234
commit 1d84a9117e
7 changed files with 5152 additions and 243 deletions

View File

@@ -213,8 +213,15 @@
})
if (physicalGpus && physicalGpus.length > 0) {
// 显示第一个物理GPU的显存使用情况
// 显示第一个物理GPU的信息
const gpu = physicalGpus[0]
// 显示GPU使用率如果可用
if (gpu.utilizationGpu !== undefined) {
gpuEl.textContent = Math.round(gpu.utilizationGpu) + '%'
}
// 显示显存使用情况
// 优先使用memoryUsed和memoryTotal如果没有则使用vram
if (gpu.memoryUsed !== undefined && gpu.memoryTotal !== undefined) {
// 转换为MB单位
@@ -266,7 +273,7 @@
let gpuUsage = 0;
if (gpuData.controllers && gpuData.controllers.length > 0) {
// 尝试获取GPU使用率如果没有则使用默认值
gpuUsage = gpuData.controllers[0].utilizationMemory || gpuData.controllers[0].fanSpeed || 0;
gpuUsage = gpuData.controllers[0].utilizationGpu || gpuData.controllers[0].utilizationMemory || 0;
}
// 更新UI