Loged stats are displayed using reverse color / Other important stat with color

This commit is contained in:
Nicolas Hennion 2012-12-08 22:42:11 +01:00
parent dbd6f0afcc
commit c60736e007

View File

@ -1458,7 +1458,14 @@ class glancesScreen:
else: else:
offset_x = 0 offset_x = 0
# display CPU stats # Log
if cpu:
logs.add(self.__getCpuAlert(cpu['user']), "CPU user",
cpu['user'], proclist)
logs.add(self.__getCpuAlert(cpu['system']), "CPU system",
cpu['system'], proclist)
# Display CPU stats
if screen_y > self.cpu_y + 5 and tag_percpu: if screen_y > self.cpu_y + 5 and tag_percpu:
# display per-CPU stats when space is available # display per-CPU stats when space is available
self.term_window.addnstr(self.cpu_y, self.cpu_x, _("PerCPU"), 6, self.term_window.addnstr(self.cpu_y, self.cpu_x, _("PerCPU"), 6,
@ -1485,7 +1492,8 @@ class glancesScreen:
# user # user
alert = self.__getCpuAlert(percpu[i]['user']) alert = self.__getCpuAlert(percpu[i]['user'])
logs.add(alert, "CPU-%d user" % i, percpu[i]['user'], proclist) # Do not log PerCpu but on ly CPU (see below)
#~ logs.add(alert, "CPU-%d user" % i, percpu[i]['user'], proclist)
self.term_window.addnstr( self.term_window.addnstr(
self.cpu_y + 1, self.cpu_x + 8 + i * 8, self.cpu_y + 1, self.cpu_x + 8 + i * 8,
format(percpu[i]['user'] / 100, '>6.1%'), 6, format(percpu[i]['user'] / 100, '>6.1%'), 6,
@ -1493,8 +1501,8 @@ class glancesScreen:
# system # system
alert = self.__getCpuAlert(percpu[i]['system']) alert = self.__getCpuAlert(percpu[i]['system'])
logs.add(alert, "CPU-%d system" % i, percpu[i]['system'], # Do not log PerCpu but on ly CPU (see below)
proclist) #~ logs.add(alert, "CPU-%d system" % i, percpu[i]['system'], proclist)
self.term_window.addnstr( self.term_window.addnstr(
self.cpu_y + 2, self.cpu_x + 8 + i * 8, self.cpu_y + 2, self.cpu_x + 8 + i * 8,
format(percpu[i]['system'] / 100, '>6.1%'), 6, format(percpu[i]['system'] / 100, '>6.1%'), 6,
@ -1523,19 +1531,19 @@ class glancesScreen:
# user # user
self.term_window.addnstr(self.cpu_y + 1, self.cpu_x, _("user:"), 5) self.term_window.addnstr(self.cpu_y + 1, self.cpu_x, _("user:"), 5)
alert = self.__getCpuAlert(cpu['user']) alert = self.__getCpuAlert(cpu['user'])
logs.add(alert, "CPU user", cpu['user'], proclist) #~ logs.add(alert, "CPU user", cpu['user'], proclist)
self.term_window.addnstr(self.cpu_y + 1, self.cpu_x + 8, self.term_window.addnstr(self.cpu_y + 1, self.cpu_x + 8,
format(cpu['user'] / 100, '>6.1%'), 6, format(cpu['user'] / 100, '>6.1%'), 6,
self.__colors_list2[alert]) self.__colors_list[alert])
# system # system
self.term_window.addnstr(self.cpu_y + 2, self.cpu_x, self.term_window.addnstr(self.cpu_y + 2, self.cpu_x,
_("system:"), 7) _("system:"), 7)
alert = self.__getCpuAlert(cpu['system']) alert = self.__getCpuAlert(cpu['system'])
logs.add(alert, "CPU system", cpu['system'], proclist) #~ logs.add(alert, "CPU system", cpu['system'], proclist)
self.term_window.addnstr(self.cpu_y + 2, self.cpu_x + 8, self.term_window.addnstr(self.cpu_y + 2, self.cpu_x + 8,
format(cpu['system'] / 100, '>6.1%'), 6, format(cpu['system'] / 100, '>6.1%'), 6,
self.__colors_list2[alert]) self.__colors_list[alert])
# idle # idle
self.term_window.addnstr(self.cpu_y + 3, self.cpu_x, _("idle:"), 5) self.term_window.addnstr(self.cpu_y + 3, self.cpu_x, _("idle:"), 5)
@ -1611,7 +1619,7 @@ class glancesScreen:
self.term_window.addnstr(self.load_y + 2, self.term_window.addnstr(self.load_y + 2,
self.load_x + offset_x + 8, self.load_x + offset_x + 8,
format(load['min5'], '>5.2f'), 5, format(load['min5'], '>5.2f'), 5,
self.__colors_list2[alert]) self.__colors_list[alert])
# 15 min # 15 min
self.term_window.addnstr(self.load_y + 3, self.term_window.addnstr(self.load_y + 3,
@ -1621,7 +1629,7 @@ class glancesScreen:
self.term_window.addnstr(self.load_y + 3, self.term_window.addnstr(self.load_y + 3,
self.load_x + offset_x + 8, self.load_x + offset_x + 8,
format(load['min15'], '>5.2f'), 5, format(load['min15'], '>5.2f'), 5,
self.__colors_list2[alert]) self.__colors_list[alert])
def displayMem(self, mem, memswap, proclist, offset_x=0): def displayMem(self, mem, memswap, proclist, offset_x=0):
# Memory # Memory
@ -1659,7 +1667,7 @@ class glancesScreen:
self.term_window.addnstr( self.term_window.addnstr(
self.mem_y + 2, self.mem_x + offset_x + 7, self.mem_y + 2, self.mem_x + offset_x + 7,
format(self.__autoUnit(mem['used']), '>5'), 5, format(self.__autoUnit(mem['used']), '>5'), 5,
self.__colors_list2[alert]) self.__colors_list[alert])
# free # free
self.term_window.addnstr(self.mem_y + 3, self.mem_x + offset_x, self.term_window.addnstr(self.mem_y + 3, self.mem_x + offset_x,
@ -1737,7 +1745,7 @@ class glancesScreen:
self.term_window.addnstr( self.term_window.addnstr(
self.mem_y + 2, self.mem_x + offset_x + 39, self.mem_y + 2, self.mem_x + offset_x + 39,
format(self.__autoUnit(memswap['used']), '>5'), 8, format(self.__autoUnit(memswap['used']), '>5'), 8,
self.__colors_list2[alert]) self.__colors_list[alert])
# free # free
self.term_window.addnstr(self.mem_y + 3, self.term_window.addnstr(self.mem_y + 3,