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)

This commit is contained in:
nicolargo 2016-03-27 23:31:25 +02:00
parent f5cc721360
commit e8fda683f1
2 changed files with 10 additions and 4 deletions

View File

@ -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) + ' '

View File

@ -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']))