From e8fda683f1035b48d763e47746973d0e05a35788 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sun, 27 Mar 2016 23:31:25 +0200 Subject: [PATCH] Use memory_info instead of memory_info_ex. Use memory_full_info with USS and PSS for the top process (extended stat) (related to issue#797) --- glances/plugins/glances_processlist.py | 4 ++-- glances/processes.py | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/glances/plugins/glances_processlist.py b/glances/plugins/glances_processlist.py index 0a5eae45..113971bb 100644 --- a/glances/plugins/glances_processlist.py +++ b/glances/plugins/glances_processlist.py @@ -322,10 +322,10 @@ class Plugin(GlancesPlugin): msg = xpad + 'CPU affinity: ' + str(len(p['cpu_affinity'])) + ' cores' ret.append(self.curse_add_line(msg, splittable=True)) # Second line is memory info - if 'memory_info_ex' in p and p['memory_info_ex'] is not None: + if 'memory_info' in p and p['memory_info'] is not None: ret.append(self.curse_new_line()) msg = xpad + 'Memory info: ' - for k, v in iteritems(p['memory_info_ex']._asdict()): + for k, v in iteritems(p['memory_info']._asdict()): # Ignore rss and vms (already displayed) if k not in ['rss', 'vms'] and v is not None: msg += k + ' ' + self.auto_unit(v, low_precision=False) + ' ' diff --git a/glances/processes.py b/glances/processes.py index 7e27a002..5ae81ebc 100644 --- a/glances/processes.py +++ b/glances/processes.py @@ -290,11 +290,17 @@ class GlancesProcesses(object): procstat['cpu_affinity'] = None # Memory extended try: - procstat.update(proc.as_dict(attrs=['memory_info_ex'])) + procstat.update(proc.as_dict(attrs=['memory_full_info'])) except psutil.NoSuchProcess: pass except AttributeError: - procstat['memory_info_ex'] = None + # Fallback to standard memory_info stats + try: + procstat.update(proc.as_dict(attrs=['memory_info'])) + except psutil.NoSuchProcess: + pass + except AttributeError: + procstat['memory_info'] = None # Number of context switch try: procstat.update(proc.as_dict(attrs=['num_ctx_switches']))