1
0
mirror of https://github.com/HorlogeSkynet/archey4 synced 2025-04-10 12:00:19 +02:00

[TEMPERATURE][LINUX] Two minor performance improvements :

+ Only performs division if value is non-null
+ Prevents useless `strip` call on file content for `float` casting
This commit is contained in:
Samuel FORESTIER 2021-03-04 18:29:50 +01:00
parent 5efd9332bb
commit 75f8864817

@ -106,12 +106,12 @@ class Temperature(Entry):
for thermal_file in iglob(r'/sys/class/thermal/thermal_zone*/temp'):
with open(thermal_file) as file:
try:
temp = float(file.read().strip()) / 1000
temp = float(file.read())
except OSError:
continue
if temp != 0.0:
self._temps.append(temp)
self._temps.append(temp / 1000)
def _run_sysctl_dev_cpu(self):
# Tries to get temperatures from each CPU core sensor.