feat: 内存占用图使用百分比
This commit is contained in:
parent
ff8a9dc8c7
commit
21e39611bc
@ -134,7 +134,7 @@ def cpu(_: schemas.TokenPayload = Depends(verify_token)) -> Any:
|
||||
return SystemUtils.cpu_usage()
|
||||
|
||||
|
||||
@router.get("/memory", summary="获取当前内存使用率", response_model=int)
|
||||
@router.get("/memory", summary="获取当前内存使用量和使用率", response_model=List[int])
|
||||
def memory(_: schemas.TokenPayload = Depends(verify_token)) -> Any:
|
||||
"""
|
||||
获取当前内存使用率
|
||||
|
@ -287,8 +287,8 @@ class SystemUtils:
|
||||
return psutil.cpu_percent()
|
||||
|
||||
@staticmethod
|
||||
def memory_usage():
|
||||
def memory_usage() -> List[int]:
|
||||
"""
|
||||
获取内存使用大小
|
||||
获取内存使用量和使用率
|
||||
"""
|
||||
return psutil.virtual_memory().used
|
||||
return [psutil.virtual_memory().used, int(psutil.virtual_memory().percent)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user