fix:仪表盘内存只显示当前程序占用

This commit is contained in:
jxxghp
2025-06-05 17:09:11 +08:00
parent dc180c09e9
commit 304af5e980
+6 -2
View File
@@ -434,9 +434,13 @@ class SystemUtils:
@staticmethod @staticmethod
def memory_usage() -> List[int]: 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 @staticmethod
def is_hardlink(src: Path, dest: Path) -> bool: def is_hardlink(src: Path, dest: Path) -> bool: