新增 显存占用显示功能;
This commit is contained in:
11
index.html
11
index.html
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user