mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-27 19:25:27 +03:00
IRIX mode off implementation (issue#628)
This commit is contained in:
parent
c9df26a227
commit
49c3c6c6be
@ -200,6 +200,7 @@ Command-Line Options
|
||||
-f PROCESS_FILTER, --process-filter PROCESS_FILTER
|
||||
set the process filter pattern (regular expression)
|
||||
--process-short-name force short name for processes name
|
||||
--disable-irix Task's cpu usage will be divided by the total number of CPUs
|
||||
--hide-kernel-threads
|
||||
hide kernel threads in process list
|
||||
--tree display processes as a tree
|
||||
@ -271,6 +272,8 @@ The following commands (key pressed) are supported while in Glances:
|
||||
Delete finished warning and critical log messages
|
||||
``z``
|
||||
Show/hide processes stats
|
||||
``0``
|
||||
Task's cpu usage will be divided by the total number of CPUs
|
||||
``1``
|
||||
Switch between global CPU and per-CPU stats
|
||||
``2``
|
||||
@ -604,6 +607,7 @@ The number of processes in the list is adapted to the screen size.
|
||||
|
||||
``CPU%``
|
||||
% of CPU used by the process
|
||||
If IRIX mode is off (aka Solaris mode), the value is divided by logical core number
|
||||
``MEM%``
|
||||
% of MEM used by the process
|
||||
``VIRT``
|
||||
|
@ -180,6 +180,8 @@ Start the client browser (browser mode):\n\
|
||||
dest='process_filter', help='set the process filter pattern (regular expression)')
|
||||
parser.add_argument('--process-short-name', action='store_true', default=False,
|
||||
dest='process_short_name', help='force short name for processes name')
|
||||
parser.add_argument('--disable-irix', action='store_true', default=False,
|
||||
dest='disable_irix', help='Task\'s cpu usage will be divided by the total number of CPUs')
|
||||
if not is_windows:
|
||||
parser.add_argument('--hide-kernel-threads', action='store_true', default=False,
|
||||
dest='no_kernel_threads', help='hide kernel threads in process list')
|
||||
|
@ -252,6 +252,9 @@ class _GlancesCurses(object):
|
||||
elif self.pressedkey == 10:
|
||||
# 'ENTER' > Edit the process filter
|
||||
self.edit_filter = not self.edit_filter
|
||||
elif self.pressedkey == ord('0'):
|
||||
# '0' > Switch between IRIX and Solaris mode
|
||||
self.args.disable_irix = not self.args.disable_irix
|
||||
elif self.pressedkey == ord('1'):
|
||||
# '1' > Switch between CPU and PerCPU information
|
||||
self.args.percpu = not self.args.percpu
|
||||
|
@ -88,6 +88,7 @@ class Plugin(GlancesPlugin):
|
||||
self.view_data['quit'] = msg_col2.format('q', 'Quit (Esc and Ctrl-C also work)')
|
||||
self.view_data['enable_disable_top_extends_stats'] = msg_col.format('e', 'Enable/disable top extended stats')
|
||||
self.view_data['enable_disable_short_processname'] = msg_col.format('/', 'Enable/disable short processes name')
|
||||
self.view_data['enable_disable_irix'] = msg_col.format('0', 'Enable/disable Irix process CPU')
|
||||
self.view_data['enable_disable_docker'] = msg_col2.format('D', 'Enable/disable Docker stats')
|
||||
self.view_data['enable_disable_quick_look'] = msg_col.format('3', 'Enable/disable quick look plugin')
|
||||
self.view_data['show_hide_ip'] = msg_col2.format('I', 'Show/hide IP module')
|
||||
@ -162,6 +163,8 @@ class Plugin(GlancesPlugin):
|
||||
ret.append(self.curse_new_line())
|
||||
ret.append(self.curse_add_line(self.view_data['enable_disable_short_processname']))
|
||||
ret.append(self.curse_new_line())
|
||||
ret.append(self.curse_add_line(self.view_data['enable_disable_irix']))
|
||||
ret.append(self.curse_new_line())
|
||||
|
||||
ret.append(self.curse_new_line())
|
||||
|
||||
|
@ -126,6 +126,8 @@ class Plugin(GlancesPlugin):
|
||||
msg = 'sorted by {0}'.format(glances_processes.sort_key)
|
||||
ret.append(self.curse_add_line(msg))
|
||||
ret[-1]["msg"] += ", %s view" % ("tree" if glances_processes.is_tree_enabled() else "flat")
|
||||
# if args.disable_irix:
|
||||
# ret[-1]["msg"] += " - IRIX off"
|
||||
|
||||
# Return the message with decoration
|
||||
return ret
|
||||
|
@ -25,6 +25,7 @@ import os
|
||||
from datetime import timedelta
|
||||
|
||||
# Import Glances libs
|
||||
from glances.plugins.glances_core import Plugin as CorePlugin
|
||||
from glances.core.glances_globals import is_windows
|
||||
from glances.core.glances_processes import glances_processes
|
||||
from glances.plugins.glances_plugin import GlancesPlugin
|
||||
@ -61,6 +62,12 @@ class Plugin(GlancesPlugin):
|
||||
# Trying to display proc time
|
||||
self.tag_proc_time = True
|
||||
|
||||
# Call CorePlugin to get the core number (needed when not in IRIX mode / Solaris mode)
|
||||
try:
|
||||
self.nb_log_core = CorePlugin(args=self.args).update()["log"]
|
||||
except Exception:
|
||||
self.nb_log_core = 0
|
||||
|
||||
# Note: 'glances_processes' is already init in the glances_processes.py script
|
||||
|
||||
def get_key(self):
|
||||
@ -174,7 +181,10 @@ class Plugin(GlancesPlugin):
|
||||
ret = [self.curse_new_line()]
|
||||
# CPU
|
||||
if 'cpu_percent' in p and p['cpu_percent'] is not None and p['cpu_percent'] != '':
|
||||
msg = '{0:>6.1f}'.format(p['cpu_percent'])
|
||||
if args.disable_irix and self.nb_log_core != 0:
|
||||
msg = '{0:>6.1f}'.format(p['cpu_percent'] / float(self.nb_log_core))
|
||||
else:
|
||||
msg = '{0:>6.1f}'.format(p['cpu_percent'])
|
||||
ret.append(self.curse_add_line(msg,
|
||||
self.get_alert(p['cpu_percent'], header="cpu")))
|
||||
else:
|
||||
@ -393,7 +403,12 @@ class Plugin(GlancesPlugin):
|
||||
sort_style = 'SORT'
|
||||
|
||||
# Header
|
||||
msg = '{0:>6}'.format('CPU%')
|
||||
if args.disable_irix and 0 < self.nb_log_core < 10:
|
||||
msg = '{0:>6}'.format('CPU%/' + str(self.nb_log_core))
|
||||
elif args.disable_irix and self.nb_log_core != 0:
|
||||
msg = '{0:>6}'.format('CPU%/C')
|
||||
else:
|
||||
msg = '{0:>6}'.format('CPU%')
|
||||
ret.append(self.curse_add_line(msg, sort_style if process_sort_key == 'cpu_percent' else 'DEFAULT'))
|
||||
msg = '{0:>6}'.format('MEM%')
|
||||
ret.append(self.curse_add_line(msg, sort_style if process_sort_key == 'memory_percent' else 'DEFAULT'))
|
||||
|
@ -145,6 +145,9 @@ set the process filter pattern (regular expression)
|
||||
.B \-\-process-short-name
|
||||
force short name for processes name
|
||||
.TP
|
||||
.B \-\-disable-irix
|
||||
Task's cpu usage will be divided by the total number of CPUs
|
||||
.TP
|
||||
.B \-\-hide-kernel-threads
|
||||
hide kernel threads in process list
|
||||
.TP
|
||||
@ -246,6 +249,9 @@ Show/hide processes stats
|
||||
.B z
|
||||
Show/hide processes list (for low CPU consumption)
|
||||
.TP
|
||||
.B 0
|
||||
Task's cpu usage will be divided by the total number of CPUs
|
||||
.TP
|
||||
.B 1
|
||||
Switch between global CPU and per-CPU stats
|
||||
.TP
|
||||
|
Loading…
Reference in New Issue
Block a user