Bug 1774144 - mach: Only report physical cores if they could be determined. r=firefox-build-system-reviewers,ahochheiden

As per the docs:

> Return the number of logical CPUs in the system (same as os.cpu_count in Python 3.4) or None if undetermined.
> [...] On OpenBSD and NetBSD psutil.cpu_count(logical=False) always return None

Glean tries to coerce values to the expected type. `None` cannot be
coerced to an integer, so this blows up.
We conditionally report that value now only if we can properly detect
one.

Differential Revision: https://phabricator.services.mozilla.com/D149201
This commit is contained in:
Jan-Erik Rediger
2022-06-15 08:10:40 +00:00
parent fcc0aae9a6
commit e307da9ba5

View File

@@ -541,7 +541,8 @@ def _finalize_telemetry_glean(telemetry, is_bootstrap, success):
# psutil may not be available (we may not have been able to download # psutil may not be available (we may not have been able to download
# a wheel or build it from source). # a wheel or build it from source).
system_metrics.logical_cores.add(logical_cores) system_metrics.logical_cores.add(logical_cores)
system_metrics.physical_cores.add(physical_cores) if physical_cores is not None:
system_metrics.physical_cores.add(physical_cores)
if memory_total is not None: if memory_total is not None:
system_metrics.memory.accumulate( system_metrics.memory.accumulate(
int(math.ceil(float(memory_total) / (1024 * 1024 * 1024))) int(math.ceil(float(memory_total) / (1024 * 1024 * 1024)))