From 304af5e980e1594e10c16e1e4c7d6bed547cb11f Mon Sep 17 00:00:00 2001 From: jxxghp Date: Thu, 5 Jun 2025 17:09:11 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BB=AA=E8=A1=A8=E7=9B=98?= =?UTF-8?q?=E5=86=85=E5=AD=98=E5=8F=AA=E6=98=BE=E7=A4=BA=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=8D=A0=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/utils/system.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/utils/system.py b/app/utils/system.py index b3b54796..f375570a 100644 --- a/app/utils/system.py +++ b/app/utils/system.py @@ -434,9 +434,13 @@ class SystemUtils: @staticmethod def memory_usage() -> List[int]: """ - 获取内存使用量和使用率 + 获取当前程序的内存使用量和使用率 """ - return [psutil.virtual_memory().used, int(psutil.virtual_memory().percent)] + current_process = psutil.Process() + process_memory = current_process.memory_info().rss + system_memory = psutil.virtual_memory().total + process_memory_percent = (process_memory / system_memory) * 100 + return [process_memory, int(process_memory_percent)] @staticmethod def is_hardlink(src: Path, dest: Path) -> bool: