From 7cecd805be403aba21aaffb2865b85b3a85d3156 Mon Sep 17 00:00:00 2001 From: Blergo Date: Tue, 2 Jul 2024 20:27:03 +0100 Subject: [PATCH] work on cpu util --- command_handlers.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/command_handlers.py b/command_handlers.py index 57b0901..1dab0a6 100644 --- a/command_handlers.py +++ b/command_handlers.py @@ -102,9 +102,7 @@ def handle_stats_steps(sender_id, message, step, interface, bbs_nodes): send_message(response, sender_id, interface) update_user_state(sender_id, {'command': 'STATS', 'step': 2}) if choice == 1: - cpu = str(psutil.cpu_percent()/psutil.cpu_count()) - time.sleep(1) - cpu = str(psutil.cpu_percent()/psutil.cpu_count()) + cpu = str(psutil.cpu_percent(interval=1)/psutil.cpu_count()) ramu = str(psutil.virtual_memory().percent) response = "CPU: " + cpu + "% Used\nRAM: " + ramu + "% Used" send_message(response, sender_id, interface)