diff options
author | Nicolargo <nicolas@nicolargo.com> | 2014-10-02 21:24:26 +0200 |
---|---|---|
committer | Nicolargo <nicolas@nicolargo.com> | 2014-10-02 21:24:26 +0200 |
commit | 287af37541cc4b45f46e9968afac535d76404faf (patch) | |
tree | 73f08c02fb93c2aa49d59175cff2f970e6133733 | |
parent | 20fbe4f5d5dd10cabf5de893ea90f60d4d637e5b (diff) | |
parent | ef158378d365c21ecb70f1c5eb76118101a98751 (diff) |
Merge branch 'release/v2.1.1'v2.1.1
-rw-r--r-- | NEWS | 15 | ||||
-rw-r--r-- | conf/glances-test.conf | 4 | ||||
-rw-r--r-- | conf/glances.conf | 4 | ||||
-rw-r--r-- | docs/glances-doc.html | 4 | ||||
-rw-r--r-- | docs/glances-doc.rst | 4 | ||||
-rw-r--r-- | glances/__init__.py | 2 | ||||
-rw-r--r-- | glances/core/glances_client.py | 9 | ||||
-rw-r--r-- | glances/core/glances_processes.py | 55 | ||||
-rw-r--r-- | glances/core/glances_standalone.py | 10 | ||||
-rw-r--r-- | glances/outputs/glances_curses.py | 15 | ||||
-rw-r--r-- | glances/plugins/glances_processlist.py | 2 | ||||
-rw-r--r-- | man/glances.1 | 2 | ||||
-rw-r--r-- | requirements.txt | 2 | ||||
-rwxr-xr-x | setup.py | 4 |
14 files changed, 78 insertions, 54 deletions
@@ -2,6 +2,21 @@ Glances Version 2.x ============================================================================== +Version 2.1.1 +============= + +Enhancement: + * Automaticaly compute top processes number for the current screen (issue #408) + * CPU and Memory footprint optimization (issue #401) + +Bugs corrected: + + * Mac OS X 10.9: Exception at start (issue #423) + * Process no longer exists (issue #421) + * Error with Glances Client with Python 3.4.1 (issue #419) + * TypeError: memory_maps() takes exactly 2 arguments (issue #413) + * No filesystem informations since Glances 2.0 bug enhancement (issue #381) + Version 2.1 =========== diff --git a/conf/glances-test.conf b/conf/glances-test.conf index fef896ec..9ca9175a 100644 --- a/conf/glances-test.conf +++ b/conf/glances-test.conf @@ -96,10 +96,6 @@ core 0_alias=CPU Core 0 core 1_alias=CPU Core 1 [processlist] -# Maximum number of processes to show in the UI -# Note: Only limit number of showed processes (not the one returned by the API) -# Default is 20 processes (Top 20) -max_processes=20 # Limit values for CPU/MEM per process in % # Default values if not defined: 50/70/90 cpu_careful=50 diff --git a/conf/glances.conf b/conf/glances.conf index c0dbb077..b571aed5 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -96,10 +96,6 @@ battery_critical=95 #core 1_alias=CPU Core 1 [processlist] -# Maximum number of processes to show in the UI -# Note: Only limit number of showed processes (not the one returned by the API) -# Default is 20 processes (Top 20) -max_processes=20 # Limit values for CPU/MEM per process in % # Default values if not defined: 50/70/90 cpu_careful=50 diff --git a/docs/glances-doc.html b/docs/glances-doc.html index 32501916..719e69e3 100644 --- a/docs/glances-doc.html +++ b/docs/glances-doc.html @@ -123,9 +123,9 @@ td.option-group { <div class="document" id="glances"> <h1 class="title">Glances</h1> -<p>This manual describes <em>Glances</em> version 2.1.</p> +<p>This manual describes <em>Glances</em> version 2.1.1.</p> <p>Copyright © 2012-2014 Nicolas Hennion <<a class="reference external" href="mailto:nicolas@nicolargo.com">nicolas@nicolargo.com</a>></p> -<p>September 2014</p> +<p>October 2014</p> <div class="contents topic" id="table-of-contents"> <p class="topic-title first">Table of Contents</p> <ul class="simple"> diff --git a/docs/glances-doc.rst b/docs/glances-doc.rst index 7f5f0b63..a2b1932e 100644 --- a/docs/glances-doc.rst +++ b/docs/glances-doc.rst @@ -2,11 +2,11 @@ Glances ======= -This manual describes *Glances* version 2.1. +This manual describes *Glances* version 2.1.1. Copyright © 2012-2014 Nicolas Hennion <nicolas@nicolargo.com> -September 2014 +October 2014 .. contents:: Table of Contents diff --git a/glances/__init__.py b/glances/__init__.py index 2ca51a14..18b9743a 100644 --- a/glances/__init__.py +++ b/glances/__init__.py @@ -20,7 +20,7 @@ """Init the Glances software.""" __appname__ = 'glances' -__version__ = '2.1' +__version__ = '2.1.1' __author__ = 'Nicolas Hennion <nicolas@nicolargo.com>' __license__ = 'LGPL' diff --git a/glances/core/glances_client.py b/glances/core/glances_client.py index faf70ae1..a0e76bf1 100644 --- a/glances/core/glances_client.py +++ b/glances/core/glances_client.py @@ -25,9 +25,14 @@ import socket import sys try: from xmlrpc.client import Transport, ServerProxy, ProtocolError, Fault -except ImportError: # Python 2 +except ImportError: + # Python 2 from xmlrpclib import Transport, ServerProxy, ProtocolError, Fault -import httplib +try: + import http.client as httplib +except: + # Python 2 + import httplib # Import Glances libs from glances.core.glances_globals import version, logger diff --git a/glances/core/glances_processes.py b/glances/core/glances_processes.py index 3d75cbdd..d67de058 100644 --- a/glances/core/glances_processes.py +++ b/glances/core/glances_processes.py @@ -66,9 +66,6 @@ class GlancesProcesses(object): self.process_filter = None self.process_filter_re = None - # !!! ONLY FOR TEST - # self.set_process_filter('.*python.*') - def enable(self): """Enable process stats.""" self.disable_tag = False @@ -158,7 +155,7 @@ class GlancesProcesses(object): # Patch for issue #391 try: self.cmdline_cache[procstat['pid']] = ' '.join(proc.cmdline()) - except (AttributeError, psutil.AccessDenied, UnicodeDecodeError): + except (AttributeError, UnicodeDecodeError, psutil.AccessDenied, psutil.NoSuchProcess): self.cmdline_cache[procstat['pid']] = "" procstat['cmdline'] = self.cmdline_cache[procstat['pid']] @@ -276,6 +273,9 @@ class GlancesProcesses(object): pass except psutil.AccessDenied: procstat['memory_swap'] = None + except: + # Add a dirty except to handle the PsUtil issue #413 + procstat['memory_swap'] = None # Process network connections (TCP and UDP) try: @@ -318,7 +318,7 @@ class GlancesProcesses(object): processdict = {} for proc in psutil.process_iter(): # If self.get_max_processes() is None: Only retreive mandatory stats - # Else: retreive mandatoryadn standard stast + # Else: retreive mandatory and standard stats s = self.__get_process_stats(proc, mandatory_stats=True, standard_stats=self.get_max_processes() is None) @@ -348,14 +348,28 @@ class GlancesProcesses(object): except: pass + # Process optimization + # Only retreive stats for visible processes (get_max_processes) if self.get_max_processes() is not None: # Sort the internal dict and cut the top N (Return a list of tuple) # tuple=key (proc), dict (returned by __get_process_stats) - processiter = sorted(processdict.items(), key=lambda x: x[1][self.getsortkey()], reverse=True) - first = True - for i in processiter[0:self.get_max_processes()]: - # Already existing mandatory stats - procstat = i[1] + try: + processiter = sorted(processdict.items(), key=lambda x: x[1][self.getsortkey()], reverse=True) + except TypeError: + # Fallback to all process (issue #423) + processloop = processdict.items() + first = False + else: + processloop = processiter[0:self.get_max_processes()] + first = True + else: + # Get all processes stats + processloop = processdict.items() + first = False + for i in processloop: + # Already existing mandatory stats + procstat = i[1] + if self.get_max_processes() is not None: # Update with standard stats # and extended stats but only for TOP (first) process s = self.__get_process_stats(i[0], @@ -365,21 +379,12 @@ class GlancesProcesses(object): if s is None: continue procstat.update(s) - # Add a specific time_since_update stats for bitrate - procstat['time_since_update'] = time_since_update - # Update process list - self.processlist.append(procstat) - # Next... - first = False - else: - # Get all the processes - for i in processdict.items(): - # Already existing mandatory and standard stats - procstat = i[1] - # Add a specific time_since_update stats for bitrate - procstat['time_since_update'] = time_since_update - # Update process list - self.processlist.append(procstat) + # Add a specific time_since_update stats for bitrate + procstat['time_since_update'] = time_since_update + # Update process list + self.processlist.append(procstat) + # Next... + first = False # Clean internals caches if timeout is reached if self.cache_timer.finished(): diff --git a/glances/core/glances_standalone.py b/glances/core/glances_standalone.py index a6586f6b..4fe860da 100644 --- a/glances/core/glances_standalone.py +++ b/glances/core/glances_standalone.py @@ -34,14 +34,8 @@ class GlancesStandalone(object): # Init stats self.stats = GlancesStats(config=config, args=args) - # If configured, set the maximum processes number to display - try: - max_processes = int(self.stats.get_plugin('processlist').get_conf_value('max_processes')) - logger.debug(_("Limit maximum displayed processes to %s") % max_processes) - except: - max_processes = None - logger.warning(_("Maximum displayed processes is not configured (high CPU consumption)")) - glances_processes.set_max_processes(max_processes) + # Default number of processes to displayed is set to 20 + glances_processes.set_max_processes(20) # If process extended stats is disabled by user if args.disable_process_extended: diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py index 9c592964..33454af6 100644 --- a/glances/outputs/glances_curses.py +++ b/glances/outputs/glances_curses.py @@ -383,6 +383,7 @@ class GlancesCurses(object): # Update the stats messages ########################### + # Update the client server status self.args.cs_status = cs_status stats_system = stats.get_plugin('system').get_stats_display(args=self.args) @@ -400,10 +401,22 @@ class GlancesCurses(object): stats_sensors = stats.get_plugin('sensors').get_stats_display(args=self.args) stats_now = stats.get_plugin('now').get_stats_display() stats_processcount = stats.get_plugin('processcount').get_stats_display(args=self.args) - stats_processlist = stats.get_plugin('processlist').get_stats_display(args=self.args) stats_monitor = stats.get_plugin('monitor').get_stats_display(args=self.args) stats_alert = stats.get_plugin('alert').get_stats_display(args=self.args) + # 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: + max_processes_displayed -= 4 + if max_processes_displayed < 0: + max_processes_displayed = 0 + if glances_processes.get_max_processes() is None or \ + glances_processes.get_max_processes() != max_processes_displayed: + logger.debug(_("Set number of displayed processes to %s") % max_processes_displayed) + glances_processes.set_max_processes(max_processes_displayed) + + stats_processlist = stats.get_plugin('processlist').get_stats_display(args=self.args) + # Display the stats on the curses interface ########################################### diff --git a/glances/plugins/glances_processlist.py b/glances/plugins/glances_processlist.py index 269a7e4f..fca5e6f8 100644 --- a/glances/plugins/glances_processlist.py +++ b/glances/plugins/glances_processlist.py @@ -343,7 +343,7 @@ class Plugin(GlancesPlugin): listsorted = sorted(self.stats, key=lambda process: process[sortedby], reverse=sortedreverse) - except KeyError: + except (KeyError, TypeError): listsorted = sorted(self.stats, key=lambda process: process['name'], reverse=False) diff --git a/man/glances.1 b/man/glances.1 index c2389d83..d8cd2951 100644 --- a/man/glances.1 +++ b/man/glances.1 @@ -1,4 +1,4 @@ -.TH glances 1 "September, 2014" "version 2.1" "USER COMMANDS" +.TH glances 1 "October, 2014" "version 2.1.1" "USER COMMANDS" .SH NAME glances \- A cross-platform curses-based system monitoring tool .SH SYNOPSIS diff --git a/requirements.txt b/requirements.txt index b7a63a89..52546a76 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -psutil==2.1.1 +psutil==2.1.3 @@ -40,13 +40,13 @@ def get_requires(): setup( name='Glances', - version='2.1', + version='2.1.1', description="A cross-platform curses-based monitoring tool", long_description=open('README.rst').read(), author='Nicolas Hennion', author_email='nicolas@nicolargo.com', url='https://github.com/nicolargo/glances', - # download_url='https://s3.amazonaws.com/glances/glances-2.1.tar.gz', + # download_url='https://s3.amazonaws.com/glances/glances-2.1.1.tar.gz', license="LGPL", keywords="cli curses monitoring system", install_requires=get_requires(), |