mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-11 09:55:33 +03:00
Make processes.sort_key configurable #1536
This commit is contained in:
parent
9943c3071b
commit
62132c16e2
@ -244,6 +244,10 @@ battery_critical=95
|
|||||||
|
|
||||||
[processlist]
|
[processlist]
|
||||||
disable=False
|
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 %
|
# Define CPU/MEM (per process) thresholds in %
|
||||||
# Default values if not defined: 50/70/90
|
# Default values if not defined: 50/70/90
|
||||||
cpu_careful=50
|
cpu_careful=50
|
||||||
|
@ -308,21 +308,6 @@ class _GlancesCurses(object):
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
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):
|
def get_key(self, window):
|
||||||
# @TODO: Check issue #163
|
# @TODO: Check issue #163
|
||||||
ret = window.getch()
|
ret = window.getch()
|
||||||
|
@ -116,6 +116,12 @@ class Plugin(GlancesPlugin):
|
|||||||
# Use to optimize space (see https://github.com/nicolargo/glances/issues/959)
|
# Use to optimize space (see https://github.com/nicolargo/glances/issues/959)
|
||||||
self.pid_max = glances_processes.pid_max
|
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
|
# Note: 'glances_processes' is already init in the processes.py script
|
||||||
|
|
||||||
def get_key(self):
|
def get_key(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user