提交 62132c16 编写于 作者: N nicolargo

Make processes.sort_key configurable #1536

上级 9943c307
......@@ -244,6 +244,10 @@ battery_critical=95
[processlist]
disable=False
# Sort key: if not defined, the sort is automatically done by Glances (recommended)
# Should be one of the following:
# cpu_percent, memory_percent, io_counters, name, cpu_times, username
#sort_key=memory_percent
# Define CPU/MEM (per process) thresholds in %
# Default values if not defined: 50/70/90
cpu_careful=50
......
......@@ -308,21 +308,6 @@ class _GlancesCurses(object):
except Exception:
pass
# def get_key(self, window):
# # Catch ESC key AND numlock key (issue #163)
# keycode = [0, 0]
# keycode[0] = window.getch()
# keycode[1] = window.getch()
#
# if keycode != [-1, -1]:
# logger.debug("Keypressed (code: %s)" % keycode)
#
# if keycode[0] == 27 and keycode[1] != -1:
# # Do not escape on specials keys
# return -1
# else:
# return keycode[0]
def get_key(self, window):
# @TODO: Check issue #163
ret = window.getch()
......
......@@ -116,6 +116,12 @@ class Plugin(GlancesPlugin):
# Use to optimize space (see https://github.com/nicolargo/glances/issues/959)
self.pid_max = glances_processes.pid_max
# Set the default sort key if it is defined in the configuration file
if 'processlist' in config.as_dict() and 'sort_key' in config.as_dict()['processlist']:
logger.debug('Configuration overwrites processes sort key by {}'.format(config.as_dict()['processlist']['sort_key']))
self.auto_sort = False
self._sort_key = config.as_dict()['processlist']['sort_key']
# Note: 'glances_processes' is already init in the processes.py script
def get_key(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册