Disable process stat extended by default (issue #430)

pull/435/head
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 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 Version 2.1.2
============= =============

View File

@ -136,9 +136,9 @@ Command-Line Options
--disable-left-sidebar --disable-left-sidebar
disable left sidebar disable left sidebar
--disable-process disable process module --disable-process disable process module
--disable-process-extended
disable extended stats on top process
--disable-log disable log module --disable-log disable log module
--enable-process-extended
enable extended stats on top process
--output-csv OUTPUT_CSV --output-csv OUTPUT_CSV
export stats to a CSV file export stats to a CSV file
-c CLIENT, --client CLIENT -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) * Openned threads, files and network sessions (TCP and UDP)
* IO nice level * 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 *Note*: limit values can be overwritten in the configuration file under
the ``[process]`` section. the ``[process]`` section.

View File

@ -57,8 +57,10 @@ class GlancesMain(object):
def init_args(self): def init_args(self):
"""Init all the command line arguments.""" """Init all the command line arguments."""
_version = "Glances v" + version + " with psutil v" + psutil_version _version = "Glances v" + version + " with psutil v" + psutil_version
parser = argparse.ArgumentParser(prog=appname, conflict_handler='resolve') parser = argparse.ArgumentParser(
parser.add_argument('-V', '--version', action='version', version=_version) prog=appname, conflict_handler='resolve')
parser.add_argument(
'-V', '--version', action='version', version=_version)
parser.add_argument('-d', '--debug', action='store_true', default=False, parser.add_argument('-d', '--debug', action='store_true', default=False,
dest='debug', help=_('Enable debug mode')) dest='debug', help=_('Enable debug mode'))
parser.add_argument('-C', '--config', dest='conf_file', 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')) dest='disable_left_sidebar', help=_('disable network, disk io, FS and sensors modules'))
parser.add_argument('--disable_left_sidebar', action='store_true', default=False, parser.add_argument('--disable_left_sidebar', action='store_true', default=False,
dest='disable_process', help=_('disable process module')) 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, parser.add_argument('--disable-log', action='store_true', default=False,
dest='disable_log', help=_('disable log module')) dest='disable_log', help=_('disable log module'))
parser.add_argument('--disable-bold', action='store_false', default=True, parser.add_argument('--disable-bold', action='store_false', default=True,
dest='disable_bold', help=_('disable bold mode in the terminal')) 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, parser.add_argument('--enable-history', action='store_true', default=False,
dest='enable_history', help=_('enable the history mode')) dest='enable_history', help=_('enable the history mode'))
parser.add_argument('--path-history', default=tempfile.gettempdir(), parser.add_argument('--path-history', default=tempfile.gettempdir(),
@ -167,7 +169,8 @@ class GlancesMain(object):
# Interactive or file password # Interactive or file password
if args.server: if args.server:
args.password = self.__get_password( args.password = self.__get_password(
description=_("Define the password for the Glances server"), description=_(
"Define the password for the Glances server"),
confirm=True) confirm=True)
elif args.client: elif args.client:
args.password = self.__get_password( args.password = self.__get_password(
@ -189,15 +192,18 @@ class GlancesMain(object):
# Filter is only available in standalone mode # Filter is only available in standalone mode
if args.process_filter is not None and not self.is_standalone(): 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) sys.exit(2)
# Check graph output path # Check graph output path
if args.enable_history and args.path_history is not None: if args.enable_history and args.path_history is not None:
if not os.access(args.path_history, os.W_OK): 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) 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 return args

View File

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

View File

@ -258,8 +258,8 @@ class GlancesCurses(object):
self.args.disable_diskio = not self.args.disable_diskio self.args.disable_diskio = not self.args.disable_diskio
elif self.pressedkey == ord('e'): elif self.pressedkey == ord('e'):
# 'e' > Enable/Disable extended stats for top process # 'e' > Enable/Disable extended stats for top process
self.args.disable_process_extended = not self.args.disable_process_extended self.args.enable_process_extended = not self.args.enable_process_extended
if self.args.disable_process_extended: if not self.args.enable_process_extended:
glances_processes.disable_extended() glances_processes.disable_extended()
else: else:
glances_processes.enable_extended() glances_processes.enable_extended()
@ -420,7 +420,7 @@ class GlancesCurses(object):
# Adapt number of processes to the available space # Adapt number of processes to the available space
max_processes_displayed = screen_y - 11 - \ max_processes_displayed = screen_y - 11 - \
self.get_stats_display_height(stats_alert) self.get_stats_display_height(stats_alert)
if not self.args.disable_process_extended: if self.args.enable_process_extended:
max_processes_displayed -= 4 max_processes_displayed -= 4
if max_processes_displayed < 0: if max_processes_displayed < 0:
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 .B \-\-disable-process
disable process module disable process module
.TP .TP
.B \-\-disable-process-extended
disable extended stats on top process
.TP
.B \-\-disable-log .B \-\-disable-log
disable log module disable log module
.TP .TP
.B \-\-enable-process-extended
enable extended stats on top process
.TP
.B \-\-output-csv OUTPUT_CSV .B \-\-output-csv OUTPUT_CSV
export stats to a CSV file export stats to a CSV file
.TP .TP