Color on extended CPU info

pull/130/head
Nicolas Hennion 2012-11-24 14:50:36 +01:00
parent 499cced514
commit 660bd52e74
1 changed files with 12 additions and 2 deletions

View File

@ -1266,6 +1266,9 @@ class glancesScreen:
def __getCpuColor(self, current=0, max=100):
return self.__getColor(current, max)
def __getExtCpuColor(self, current=0, max=100):
return self.__getColor2(current, max)
def __getLoadAlert(self, current=0, core=1):
# If current < CAREFUL*core of max then alert = OK
# If current > CAREFUL*core of max then alert = CAREFUL
@ -1578,13 +1581,15 @@ class glancesScreen:
"%.1f" % cpu['idle'], 8)
try:
self.term_window.addnstr(self.cpu_y + 2, self.cpu_x + 27,
"%.1f" % cpu['iowait'], 8)
"%.1f" % cpu['iowait'], 8,
self.__getExtCpuColor(cpu['iowait']))
except:
self.term_window.addnstr(self.cpu_y + 2, self.cpu_x + 27,
"N/A", 8)
try:
self.term_window.addnstr(self.cpu_y + 3, self.cpu_x + 27,
"%.1f" % cpu['irq'], 8)
"%.1f" % cpu['irq'], 8,
self.__getExtCpuColor(cpu['irq']))
except:
self.term_window.addnstr(self.cpu_y + 3, self.cpu_x + 27,
"N/A", 8)
@ -2553,6 +2558,11 @@ class GlancesInstance():
self.__update__()
return json.dumps(stats.getMemSwap())
def getNow(self):
# Update and return current date/hour
self.__update__()
return json.dumps(stats.getNow())
class GlancesServer():
"""