mirror of
https://github.com/nicolargo/glances.git
synced 2024-08-16 16:00:27 +03:00
Optimize
This commit is contained in:
parent
65f84fd1e9
commit
5ad9e89658
@ -71,9 +71,8 @@ class CpuPercent:
|
||||
|
||||
def __get_cpu_name(self):
|
||||
# Get the CPU name once from the /proc/cpuinfo file
|
||||
# Linux/Unix only
|
||||
# Read the first line with the "model name"
|
||||
ret = 'CPU'
|
||||
ret = None
|
||||
try:
|
||||
cpuinfo_file = open('/proc/cpuinfo').readlines()
|
||||
except (FileNotFoundError, PermissionError):
|
||||
@ -83,7 +82,7 @@ class CpuPercent:
|
||||
if line.startswith('model name'):
|
||||
ret = line.split(':')[1].strip()
|
||||
break
|
||||
return ret
|
||||
return ret if ret else 'CPU'
|
||||
|
||||
def __get_cpu(self):
|
||||
"""Update and/or return the CPU using the psutil library."""
|
||||
|
Loading…
Reference in New Issue
Block a user