From bee43980da035da6e0ec86903efdfdae91bb8747 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Fri, 5 Jul 2024 23:07:33 +0800 Subject: [PATCH] Fix core/thread count calculation --- agent.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/agent.py b/agent.py index 7e25a09..c9fef42 100644 --- a/agent.py +++ b/agent.py @@ -217,7 +217,10 @@ class ServerData: if section['DMIType'] == 4: # 4 corresponds to processor core_count = int(section.get('Core Count', '0')) thread_count = int(section.get('Thread Count', '0')) - cpu_count = core_count * thread_count + if thread_count: + cpu_count += thread_count + else: + cpu_count += core_count if cpu_count == 0: with open('/proc/cpuinfo', 'r') as f: cpuinfo = f.read()