Disable process stat extended by default (issue #430)

This commit is contained in:
Nicolargo 2014-10-19 16:21:22 +02:00
parent ed30ebf72b
commit 1c79191800
6 changed files with 31 additions and 24 deletions

3
NEWS
View File

@ -5,7 +5,8 @@ Glances Version 2.x
Version 2.2
===========
...
* Improve graph history feature (issue #428)
* Extended stats is disable by default (use --enable-process-extended to enable it - issue #430)
Version 2.1.2
=============

View File

@ -136,9 +136,9 @@ Command-Line Options
--disable-left-sidebar
disable left sidebar
--disable-process disable process module
--disable-process-extended
disable extended stats on top process
--disable-log disable log module
--enable-process-extended
enable extended stats on top process
--output-csv OUTPUT_CSV
export stats to a CSV file
-c CLIENT, --client CLIENT
@ -545,7 +545,7 @@ In standalone mode, additionals informations are provided for the top process:
* Openned threads, files and network sessions (TCP and UDP)
* IO nice level
The extended stats feature could be disabled using the --disable-process-extended option (command line) or the ``e`` key (curses interface).
The extended stats feature could be enabled using the --enable-process-extended option (command line) or the ``e`` key (curses interface).
*Note*: limit values can be overwritten in the configuration file under
the ``[process]`` section.

View File

@ -57,8 +57,10 @@ class GlancesMain(object):
def init_args(self):
"""Init all the command line arguments."""
_version = "Glances v" + version + " with psutil v" + psutil_version
parser = argparse.ArgumentParser(prog=appname, conflict_handler='resolve')
parser.add_argument('-V', '--version', action='version', version=_version)
parser = argparse.ArgumentParser(
prog=appname, conflict_handler='resolve')
parser.add_argument(
'-V', '--version', action='version', version=_version)
parser.add_argument('-d', '--debug', action='store_true', default=False,
dest='debug', help=_('Enable debug mode'))
parser.add_argument('-C', '--config', dest='conf_file',
@ -76,12 +78,12 @@ class GlancesMain(object):
dest='disable_left_sidebar', help=_('disable network, disk io, FS and sensors modules'))
parser.add_argument('--disable_left_sidebar', action='store_true', default=False,
dest='disable_process', help=_('disable process module'))
parser.add_argument('--disable-process-extended', action='store_true', default=False,
dest='disable_process_extended', help=_('disable extended stats on top process'))
parser.add_argument('--disable-log', action='store_true', default=False,
dest='disable_log', help=_('disable log module'))
parser.add_argument('--disable-bold', action='store_false', default=True,
dest='disable_bold', help=_('disable bold mode in the terminal'))
parser.add_argument('--enable-process-extended', action='store_false', default=False,
dest='enable_process_extended', help=_('enable extended stats on top process'))
parser.add_argument('--enable-history', action='store_true', default=False,
dest='enable_history', help=_('enable the history mode'))
parser.add_argument('--path-history', default=tempfile.gettempdir(),
@ -144,14 +146,14 @@ class GlancesMain(object):
from logging import DEBUG
logger.setLevel(DEBUG)
# Client/server Port
# Client/server Port
if args.port is None:
if args.webserver:
args.port = self.web_server_port
else:
args.port = self.server_port
args.port = self.server_port
# In web server mode, defaul refresh time: 5 sec
# In web server mode, defaul refresh time: 5 sec
if args.webserver:
args.time = 5
@ -167,7 +169,8 @@ class GlancesMain(object):
# Interactive or file password
if args.server:
args.password = self.__get_password(
description=_("Define the password for the Glances server"),
description=_(
"Define the password for the Glances server"),
confirm=True)
elif args.client:
args.password = self.__get_password(
@ -189,15 +192,18 @@ class GlancesMain(object):
# Filter is only available in standalone mode
if args.process_filter is not None and not self.is_standalone():
logger.critical(_("Process filter is only available in standalone mode"))
logger.critical(
_("Process filter is only available in standalone mode"))
sys.exit(2)
# Check graph output path
if args.enable_history and args.path_history is not None:
if not os.access(args.path_history, os.W_OK):
logger.critical(_("History output path (%s) do not exist or is not writable") % args.path_history)
logger.critical(
_("History output path (%s) do not exist or is not writable") % args.path_history)
sys.exit(2)
logger.debug(_("History output path is set to %s") % args.path_history)
logger.debug(_("History output path is set to %s") %
args.path_history)
return args

View File

@ -38,11 +38,11 @@ class GlancesStandalone(object):
glances_processes.set_max_processes(50)
# If process extended stats is disabled by user
if args.disable_process_extended:
logger.info(_("Extended stats for top process is disabled"))
if not args.enable_process_extended:
logger.info(_("Extended stats for top process is disabled (default behavor)"))
glances_processes.disable_extended()
else:
logger.debug(_("Extended stats for top process is enabled (default behavor)"))
logger.debug(_("Extended stats for top process is enabled"))
glances_processes.enable_extended()
# Manage optionnal process filter

View File

@ -258,8 +258,8 @@ class GlancesCurses(object):
self.args.disable_diskio = not self.args.disable_diskio
elif self.pressedkey == ord('e'):
# 'e' > Enable/Disable extended stats for top process
self.args.disable_process_extended = not self.args.disable_process_extended
if self.args.disable_process_extended:
self.args.enable_process_extended = not self.args.enable_process_extended
if not self.args.enable_process_extended:
glances_processes.disable_extended()
else:
glances_processes.enable_extended()
@ -420,7 +420,7 @@ class GlancesCurses(object):
# Adapt number of processes to the available space
max_processes_displayed = screen_y - 11 - \
self.get_stats_display_height(stats_alert)
if not self.args.disable_process_extended:
if self.args.enable_process_extended:
max_processes_displayed -= 4
if max_processes_displayed < 0:
max_processes_displayed = 0

View File

@ -61,12 +61,12 @@ disable network, disk IO, FS and sensors modules
.B \-\-disable-process
disable process module
.TP
.B \-\-disable-process-extended
disable extended stats on top process
.TP
.B \-\-disable-log
disable log module
.TP
.B \-\-enable-process-extended
enable extended stats on top process
.TP
.B \-\-output-csv OUTPUT_CSV
export stats to a CSV file
.TP