This commit is contained in:
José Henrique Ivanchechen 2023-08-31 19:18:37 -03:00
parent c101d0ca5e
commit 83605f9095
1 changed files with 2 additions and 7 deletions

View File

@ -114,14 +114,9 @@ def get_resource_usage():
def get_cpu_usage(stats):
UsageDelta = stats['cpu_stats']['cpu_usage']['total_usage'] - stats['precpu_stats']['cpu_usage']['total_usage']
SystemDelta = stats['cpu_stats']['cpu_usage']['system_cpu_usage'] - stats['precpu_stats']['cpu_usage']['system_cpu_usage']
len_cpu = len(stats['cpu_stats']['cpu_usage']['percpu_usage'])
SystemDelta = stats['cpu_stats']['system_cpu_usage'] - stats['precpu_stats']['system_cpu_usage']
len_cpu = stats['cpu_stats']['online_cpus']
percentage = (UsageDelta / SystemDelta) * len_cpu * 100
# percent = round(percentage, 2)
return f"{percentage:.2f}"
def get_ram_usage(stats):