From 83605f90958465f54421f1bcfa2ab68afb30cd4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Henrique=20Ivanchechen?= Date: Thu, 31 Aug 2023 19:18:37 -0300 Subject: [PATCH] fix cpu --- scripts/testes.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/scripts/testes.py b/scripts/testes.py index fe8010a..587cf2a 100644 --- a/scripts/testes.py +++ b/scripts/testes.py @@ -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):