Commit 1bb96c51 authored by Jelte Jansen's avatar Jelte Jansen

[2172] use 3-tuple instead of fixed-size list for loadavg

parent 3fc727f1
......@@ -90,8 +90,7 @@ def main():
write_value(f, ' + Hostname: %s\n', s.get_platform_hostname)
write_value(f, ' + Uptime: %d seconds\n', s.get_uptime)
l = s.get_loadavg()
f.write(' + Loadavg: %f %f %f\n' % (l[0], l[1], l[2]))
write_value(f, ' + Loadavg: %f %f %f\n', s.get_loadavg)
f.write('\nMemory\n');
write_value(f, ' + Total: %d bytes\n', s.get_mem_total)
......
......@@ -164,7 +164,7 @@ class SysInfoLinux(SysInfoPOSIX):
with open('/proc/loadavg') as f:
l = f.read().strip().split(' ')
if len(l) >= 3:
self._loadavg = [float(l[0]), float(l[1]), float(l[2])]
self._loadavg = (float(l[0]), float(l[1]), float(l[2]))
with open('/proc/meminfo') as f:
m = f.readlines()
......@@ -315,7 +315,7 @@ class SysInfoOpenBSD(SysInfoBSD):
s = subprocess.check_output(['sysctl', '-n', 'vm.loadavg'])
l = s.decode('utf-8').strip().split(' ')
if len(l) >= 3:
self._loadavg = [float(l[0]), float(l[1]), float(l[2])]
self._loadavg = (float(l[0]), float(l[1]), float(l[2]))
except (subprocess.CalledProcessError, OSError):
pass
......@@ -370,7 +370,7 @@ class SysInfoFreeBSDOSX(SysInfoBSD):
else:
la = l.split(' ')
if len(la) >= 3:
self._loadavg = [float(la[0]), float(la[1]), float(la[2])]
self._loadavg = (float(la[0]), float(la[1]), float(la[2]))
except (subprocess.CalledProcessError, OSError):
pass
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment