add system apis

This commit is contained in:
jxxghp
2023-09-04 11:07:30 +08:00
parent 96f17e2bc2
commit e4b63eacae
2 changed files with 30 additions and 0 deletions

View File

@ -278,3 +278,17 @@ class SystemUtils:
if os.path.isdir(vol):
vols.append(vol)
return vols
@staticmethod
def cpu_usage():
"""
获取CPU使用率
"""
return psutil.cpu_percent()
@staticmethod
def memory_usage():
"""
获取内存使用大小
"""
return psutil.virtual_memory().used