RC2 - Correct bug with cpu_affinity on Mac OS

This commit is contained in:
Nicolargo 2014-08-25 13:51:27 +02:00
parent d9c489d88a
commit 2f1a4576b3
2 changed files with 22 additions and 7 deletions

View File

@ -20,7 +20,7 @@
"""Init the Glances software.""" """Init the Glances software."""
__appname__ = 'glances' __appname__ = 'glances'
__version__ = '2.1_RC1' __version__ = '2.1_RC2'
__author__ = 'Nicolas Hennion <nicolas@nicolargo.com>' __author__ = 'Nicolas Hennion <nicolas@nicolargo.com>'
__license__ = 'LGPL' __license__ = 'LGPL'

View File

@ -215,16 +215,31 @@ class GlancesProcesses(object):
if extended_stats and not self.disable_extended_tag: if extended_stats and not self.disable_extended_tag:
procstat['extended_stats'] = True procstat['extended_stats'] = True
# CPU affinity # CPU affinity (Windows and Linux only)
try:
procstat.update(proc.as_dict(attrs=['cpu_affinity']))
except AttributeError:
procstat['cpu_affinity'] = None
# Memory extended # Memory extended
try:
procstat.update(proc.as_dict(attrs=['memory_info_ex']))
except AttributeError:
procstat['memory_info_ex'] = None
# Number of context switch # Number of context switch
try:
procstat.update(proc.as_dict(attrs=['num_ctx_switches']))
except AttributeError:
procstat['num_ctx_switches'] = None
# Number of file descriptors (Unix only) # Number of file descriptors (Unix only)
try:
procstat.update(proc.as_dict(attrs=['num_fds']))
except AttributeError:
procstat['num_fds'] = None
# Threads number # Threads number
procstat.update(proc.as_dict(attrs=['cpu_affinity', try:
'memory_info_ex', procstat.update(proc.as_dict(attrs=['num_threads']))
'num_ctx_switches', except AttributeError:
'num_fds', procstat['num_threads'] = None
'num_threads']))
# Number of handles (Windows only) # Number of handles (Windows only)
if is_windows: if is_windows: