Per-CPU: Fix crash on non-Linux platforms

Use 'idle' instead of 'iowait' since the latter is available only on
Linux.
pull/367/head
Alessio Sergi 2014-06-01 17:22:22 +02:00
parent 483c01d9fd
commit f64533e49c
1 changed files with 4 additions and 4 deletions

View File

@ -181,15 +181,15 @@ class Plugin(GlancesPlugin):
msg = ' {0:>6.1%}'.format(cpu['system'] / 100) msg = ' {0:>6.1%}'.format(cpu['system'] / 100)
ret.append(self.curse_add_line(msg, self.get_alert(cpu['system'], header="system"))) ret.append(self.curse_add_line(msg, self.get_alert(cpu['system'], header="system")))
# IoWait CPU # Idle CPU
if 'user' in self.stats[0]: if 'user' in self.stats[0]:
# New line # New line
ret.append(self.curse_new_line()) ret.append(self.curse_new_line())
msg = '{0:8}'.format(_("iowait:")) msg = '{0:8}'.format(_("idle:"))
ret.append(self.curse_add_line(msg)) ret.append(self.curse_add_line(msg))
for cpu in self.stats: for cpu in self.stats:
msg = ' {0:>6.1%}'.format(cpu['iowait'] / 100) msg = ' {0:>6.1%}'.format(cpu['idle'] / 100)
ret.append(self.curse_add_line(msg, self.get_alert(cpu['iowait'], header="iowait"))) ret.append(self.curse_add_line(msg))
# Return the message with decoration # Return the message with decoration
return ret return ret