diff --git a/index.html b/index.html index 0c034c6..5795a8d 100644 --- a/index.html +++ b/index.html @@ -266,9 +266,17 @@ userInfo.classList.add('user-info'); userInfo.innerHTML = "使用情况:"; - for (const [username, pid] of Object.entries(gpu.users)) { - userInfo.innerHTML += `${username} (${pid}) `; - } + // for (const [username, mem] of Object.entries(gpu.users)) { + // userInfo.innerHTML += `${username} (${mem}) `; + // } + // 排序 + const user_entries = Object.entries(gpu.users); + const sorted_user = user_entries.sort((a, b) => b[1] - a[1]); + sorted_user.forEach(([key, value]) => { + // 过滤小于50MB的 + if (value > 40) + userInfo.innerHTML += `${key} (${value}) `; + }); gpuInfo.appendChild(userInfo); // 将用户信息添加到GPU信息中 }