From 9d0d43d22a0644f1e671e3d225ef0fb67b306b76 Mon Sep 17 00:00:00 2001 From: lxbhahaha <32586299+lxbhahaha@users.noreply.github.com> Date: Wed, 16 Oct 2024 20:23:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BD=BF=E7=94=A8=E6=83=85?= =?UTF-8?q?=E5=86=B5=E7=9A=84=E6=8C=89=E5=A4=A7=E5=B0=8F=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E4=B8=94=E8=BF=87=E6=BB=A450MB=E4=BB=A5?= =?UTF-8?q?=E4=B8=8B=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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信息中 }