mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 1240059 - Treat psutil as optional in record_resource_usage. r=gps
--HG-- extra : commitid : luOomgRgcQ
This commit is contained in:
parent
592b12bb62
commit
8d867f3c62
@ -414,17 +414,27 @@ class BuildMonitor(MozbuildObject):
|
||||
# TODO: it would be nice to collect data on the storage device as well
|
||||
o['system'] = dict(
|
||||
architecture=list(platform.architecture()),
|
||||
logical_cpu_count=psutil.cpu_count(),
|
||||
machine=platform.machine(),
|
||||
physical_cpu_count=psutil.cpu_count(logical=False),
|
||||
python_version=platform.python_version(),
|
||||
release=platform.release(),
|
||||
system=platform.system(),
|
||||
swap_total=psutil.swap_memory()[0],
|
||||
version=platform.version(),
|
||||
vmem_total=psutil.virtual_memory()[0],
|
||||
)
|
||||
|
||||
# If the imports for this file ran before the in-tree virtualenv
|
||||
# was bootstrapped (for instance, for a clobber build in automation),
|
||||
# psutil might not be available.
|
||||
#
|
||||
# Treat psutil as optional to avoid an outright failure to log resources
|
||||
# in this case.
|
||||
if psutil:
|
||||
o['system'].update(dict(
|
||||
logical_cpu_count=psutil.cpu_count(),
|
||||
physical_cpu_count=psutil.cpu_count(logical=False),
|
||||
swap_total=psutil.swap_memory()[0],
|
||||
vmem_total=psutil.virtual_memory()[0],
|
||||
))
|
||||
|
||||
if platform.system() == 'Linux':
|
||||
dist = list(platform.linux_distribution())
|
||||
o['system']['linux_distribution'] = dist
|
||||
|
Loading…
Reference in New Issue
Block a user