提交 b70e916c 编写于 作者: N nicolargo

Add reset key for process summary min/max

上级 1b18e3f4
......@@ -7,7 +7,8 @@ Version 2.x
Enhancements and new features:
* [WebUI] add "pointer" cursor for sortable columns (issue #704 from @notFloran)
* Add process summary min/max stats (issue #703)
* [WebUI] add "pointer" cursor for sortable columns (issue #704 from @notFloran)
Version 2.5.1
=============
......
......@@ -258,6 +258,8 @@ The following commands (key pressed) are supported while in Glances:
Show/hide log messages
``m``
Sort processes by MEM usage
``M``
Reset processes summary min/max
``n``
Show/hide network stats
``p``
......@@ -266,6 +268,8 @@ The following commands (key pressed) are supported while in Glances:
Quit the current Glances session
``r``
Reset history
``R``
Show/Hide RAID plugins
``s``
Show/hide sensors stats
``t``
......
......@@ -85,6 +85,9 @@ class _GlancesCurses(object):
# Init edit filter tag
self.edit_filter = False
# Init the process min/max reset
self.args.reset_minmax_tag = False
# Catch key pressed with non blocking mode
self.no_flash_cursor()
self.term_window.nodelay(1)
......@@ -350,6 +353,9 @@ class _GlancesCurses(object):
# 'm' > Sort processes by MEM usage
glances_processes.auto_sort = False
glances_processes.sort_key = 'memory_percent'
elif self.pressedkey == ord('M'):
# 'M' > Reset processes summary min/max
self.args.reset_minmax_tag = not self.args.reset_minmax_tag
elif self.pressedkey == ord('n'):
# 'n' > Show/hide network stats
self.args.disable_network = not self.args.disable_network
......
......@@ -421,6 +421,9 @@ class Plugin(GlancesPlugin):
# End of extended stats
first = False
if glances_processes.process_filter is not None:
if args.reset_minmax_tag:
args.reset_minmax_tag = not args.reset_minmax_tag
self.__mmm_reset()
self.__msg_curse_sum(ret, args=args)
self.__msg_curse_sum(ret, mmm='min', args=args)
self.__msg_curse_sum(ret, mmm='max', args=args)
......@@ -540,10 +543,12 @@ class Plugin(GlancesPlugin):
ret.append(self.curse_add_line(msg, optional=True, additional=True))
ret.append(self.curse_add_line(msg, optional=True, additional=True))
if mmm is None:
msg = ' < {0:8}'.format('current')
msg = ' < {0}'.format('current')
ret.append(self.curse_add_line(msg, optional=True))
else:
msg = ' < {0:8}'.format(mmm)
msg = ' < {0}'.format(mmm)
ret.append(self.curse_add_line(msg, optional=True))
msg = ' (\'M\' to reset)'
ret.append(self.curse_add_line(msg, optional=True))
def __mmm_deco(self, mmm):
......@@ -555,6 +560,13 @@ class Plugin(GlancesPlugin):
else:
return 'FILTER'
def __mmm_reset(self):
"""
Reset the MMM stats
"""
self.mmm_min = {}
self.mmm_max = {}
def __sum_stats(self, key, indice=None, mmm=None):
"""
Return the sum of the stats value for the given key
......
......@@ -228,6 +228,9 @@ Show/hide log messages
.B m
Sort processes by MEM usage
.TP
.B M
Reset processes summary min/max
.TP
.B n
Show/hide network stats
.TP
......@@ -240,6 +243,9 @@ Quit
.B r
Reset history
.TP
.B R
Disable/enable RAID plugins
.TP
.B s
Show/hide sensors stats
.TP
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册