Browse Source

getformance.getcpu(): if no cpu info, fallback to platform.platform()

pull/888/head
SanderJo 8 years ago
committed by Safihre
parent
commit
31c0c239f9
  1. 11
      sabnzbd/utils/getperformance.py

11
sabnzbd/utils/getperformance.py

@ -3,8 +3,7 @@ import platform, subprocess
def getcpu():
# find the CPU name (which needs a different method per OS), and return it
# return None if none found
# works on Linux, MacOS (aka OSX), Windows
# If none found, return platform.platform().
cputype = None
@ -25,15 +24,17 @@ def getcpu():
# model name : Intel(R) Xeon(R) CPU E5335 @ 2.00GHz
cputype = myline.split(":", 1)[1] # get everything after the first ":"
break # we're done
except:
# An exception, maybe due to a subprocess call gone wrong
cputype = "Unknown"
pass
if cputype:
# remove unnneeded space:
# OK, found. Remove unnneeded spaces:
cputype = " ".join(cputype.split())
else:
# Not found, so let's fall back to platform()
cputype = platform.platform()
return cputype

Loading…
Cancel
Save