Skip to content

Commit

Permalink
Disable process stat extended by default (issue nicolargo#430)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolargo committed Oct 19, 2014
1 parent ed30ebf commit 1c79191
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 24 deletions.
3 changes: 2 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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
=============
Expand Down
6 changes: 3 additions & 3 deletions docs/glances-doc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
28 changes: 17 additions & 11 deletions glances/core/glances_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ def __init__(self):
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',
Expand All @@ -76,12 +78,12 @@ def init_args(self):
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(),
Expand Down Expand Up @@ -144,14 +146,14 @@ def parse_args(self):
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

Expand All @@ -167,7 +169,8 @@ def parse_args(self):
# 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(
Expand All @@ -189,15 +192,18 @@ def parse_args(self):

# 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

Expand Down
6 changes: 3 additions & 3 deletions glances/core/glances_standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ def __init__(self, config=None, args=None):
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
Expand Down
6 changes: 3 additions & 3 deletions glances/outputs/glances_curses.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ def __catch_key(self):
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()
Expand Down Expand Up @@ -420,7 +420,7 @@ def display(self, stats, cs_status="None"):
# 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
Expand Down
6 changes: 3 additions & 3 deletions man/glances.1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1c79191

Please sign in to comment.