提交 be0c7f8c 编写于 作者: N nicolargo

Merge branch 'issue1903' into develop

......@@ -12,6 +12,7 @@ venv-dev:
./venv/bin/pip install -r doc-requirements.txt
venv-dev-upgrade:
./venv/bin/pip install --upgrade pip
./venv/bin/pip install --upgrade -r dev-requirements.txt
./venv/bin/pip install --upgrade -r doc-requirements.txt
......
......@@ -38,6 +38,19 @@ automatically sorted by:
- ``MEM``: if a memory alert is detected
- ``DISK I/O``: if a CPU iowait alert is detected
You can also set the sort key in the UI:
- by clicking on left and right arrows
- by clicking on the following shortcuts or command line option:
===== ==================== ===============================
``a`` Automatic sort
``c`` Sort by CPU --sort-processes cpu_percent
``i`` Sort by DISK I/O --sort-processes io_counters
``m`` Sort by MEM --sort-processes memory_percent
``p`` Sort by process name --sort-processes name
``t`` Sort by CPU times --sort-processes cpu_times
``u`` Sort by username --sort-processes username
The number of processes in the list is adapted to the screen size.
Columns display
......
此差异已折叠。
.\" Man page generated from reStructuredText.
.
.TH "GLANCES" "1" "Jul 24, 2021" "3.2.2" "Glances"
.TH "GLANCES" "1" "Aug 01, 2021" "3.2.3_beta1" "Glances"
.SH NAME
glances \- An eye on your system
.
......
......@@ -27,6 +27,7 @@ from glances import __version__, psutil_version
from glances.compat import input, disable, enable
from glances.config import Config
from glances.globals import WINDOWS
from glances.processes import sort_processes_key_list
from glances.logger import logger, LOG_FILENAME
......@@ -157,6 +158,10 @@ Examples of use:
dest='enable_irq', help='enable IRQ module'),
parser.add_argument('--enable-process-extended', action='store_true', default=False,
dest='enable_process_extended', help='enable extended stats on top process')
# Sort processes list
parser.add_argument('--sort-processes', dest='sort_processes_key',
choices=sort_processes_key_list,
help='Sort processes by: {}'.format(', '.join(sort_processes_key_list)))
# Export modules feature
parser.add_argument('--export', dest='export',
help='enable export module (comma separed list)')
......
......@@ -26,7 +26,7 @@ from glances.compat import nativestr, u, itervalues, enable, disable
from glances.globals import MACOS, WINDOWS
from glances.logger import logger
from glances.events import glances_events
from glances.processes import glances_processes
from glances.processes import glances_processes, sort_processes_key_list
from glances.timer import Timer
# Import curses library for "normal" operating system
......@@ -106,8 +106,7 @@ class _GlancesCurses(object):
# 'DOWN' > Down in the server list
}
_sort_loop = ['cpu_percent', 'memory_percent', 'username',
'cpu_times', 'io_counters', 'name']
_sort_loop = sort_processes_key_list
# Define top menu
_top = ['quicklook', 'cpu', 'percpu', 'gpu', 'mem', 'memswap', 'load']
......
......@@ -722,7 +722,7 @@
},
"chalk": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"dev": true,
"requires": {
......@@ -1997,7 +1997,7 @@
"dependencies": {
"combined-stream": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz",
"resolved": "http://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz",
"integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=",
"dev": true,
"requires": {
......@@ -2995,7 +2995,7 @@
},
"load-json-file": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
"resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
"integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
"dev": true,
"requires": {
......@@ -3806,7 +3806,7 @@
},
"os-locale": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
"resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
"integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
"dev": true,
"requires": {
......
......@@ -124,6 +124,10 @@ class Plugin(GlancesPlugin):
config.as_dict()['processlist']['sort_key']))
glances_processes.set_sort_key(config.as_dict()['processlist']['sort_key'], False)
# The default sort key could also be overwrite by command line (see #1903)
if args.sort_processes_key is not None:
glances_processes.set_sort_key(args.sort_processes_key, False)
# Note: 'glances_processes' is already init in the processes.py script
def get_key(self):
......
......@@ -27,6 +27,14 @@ from glances.logger import logger
import psutil
# This constant defines the list of available processes sort key
sort_processes_key_list = ['cpu_percent',
'memory_percent',
'username',
'cpu_times',
'io_counters',
'name']
class GlancesProcesses(object):
"""Get processed stats using the psutil library."""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册