Fix core/thread count calculation
All checks were successful
buildbot/multibuild_parent Build done.
buildbot/travis_bionic Build done.

This commit is contained in:
Peter Šurda 2024-07-05 23:07:33 +08:00
parent ca77ce4c45
commit bee43980da
Signed by: PeterSurda
GPG Key ID: 3E47497CF67ABB95

View File

@ -217,7 +217,10 @@ class ServerData:
if section['DMIType'] == 4: # 4 corresponds to processor if section['DMIType'] == 4: # 4 corresponds to processor
core_count = int(section.get('Core Count', '0')) core_count = int(section.get('Core Count', '0'))
thread_count = int(section.get('Thread 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: if cpu_count == 0:
with open('/proc/cpuinfo', 'r') as f: with open('/proc/cpuinfo', 'r') as f:
cpuinfo = f.read() cpuinfo = f.read()