Bug 1867968. Remove some unused build telemetry code. r=firefox-build-system-reviewers,glandium

Some time after bug 1237610 originally added telemetry gathering to the build
process, the code changed to gather it via Glean in bug 1651424. Later, bug
1867968 removed some of the old code, but it missed the removal of
get_build_opts. This change removes that function and a few other functions in
the same file that appear to be unused.

Differential Revision: https://phabricator.services.mozilla.com/D195354
This commit is contained in:
Jonathan Watt 2023-12-05 09:21:00 +00:00
Родитель a8e3936c65
Коммит 894d006fd2
1 изменённых файлов: 0 добавлений и 73 удалений

Просмотреть файл

@ -6,7 +6,6 @@
This file contains functions used for telemetry.
"""
import math
import os
import platform
import sys
@ -14,8 +13,6 @@ import sys
import distro
import mozpack.path as mozpath
from .base import BuildEnvironmentNotFoundException
def cpu_brand_linux():
"""
@ -90,12 +87,6 @@ def get_cpu_brand():
}.get(platform.system(), lambda: None)()
def get_os_name():
return {"Linux": "linux", "Windows": "windows", "Darwin": "macos"}.get(
platform.system(), "other"
)
def get_psutil_stats():
"""Return whether psutil exists and its associated stats.
@ -115,70 +106,6 @@ def get_psutil_stats():
return False, None, None, None
def get_system_info():
"""
Gather info to fill the `system` keys in the schema.
"""
# Normalize OS names a bit, and bucket non-tier-1 platforms into "other".
has_psutil, logical_cores, physical_cores, memory_total = get_psutil_stats()
info = {"os": get_os_name()}
if has_psutil:
# `total` on Linux is gathered from /proc/meminfo's `MemTotal`, which is the
# total amount of physical memory minus some kernel usage, so round up to the
# nearest GB to get a sensible answer.
info["memory_gb"] = int(math.ceil(float(memory_total) / (1024 * 1024 * 1024)))
info["logical_cores"] = logical_cores
if physical_cores is not None:
info["physical_cores"] = physical_cores
cpu_brand = get_cpu_brand()
if cpu_brand is not None:
info["cpu_brand"] = cpu_brand
# TODO: drive_is_ssd, virtual_machine: https://bugzilla.mozilla.org/show_bug.cgi?id=1481613
return info
def get_build_opts(substs):
"""
Translate selected items from `substs` into `build_opts` keys in the schema.
"""
try:
opts = {
k: ty(substs.get(s, None))
for (k, s, ty) in (
# Selected substitutions.
("artifact", "MOZ_ARTIFACT_BUILDS", bool),
("debug", "MOZ_DEBUG", bool),
("opt", "MOZ_OPTIMIZE", bool),
("ccache", "CCACHE", bool),
("sccache", "MOZ_USING_SCCACHE", bool),
)
}
compiler = substs.get("CC_TYPE", None)
if compiler:
opts["compiler"] = str(compiler)
if substs.get("CXX_IS_ICECREAM", None):
opts["icecream"] = True
return opts
except BuildEnvironmentNotFoundException:
return {}
def get_build_attrs(attrs):
"""
Extracts clobber and cpu usage info from command attributes.
"""
res = {}
clobber = attrs.get("clobber")
if clobber:
res["clobber"] = clobber
usage = attrs.get("usage")
if usage:
cpu_percent = usage.get("cpu_percent")
if cpu_percent:
res["cpu_percent"] = int(round(cpu_percent))
return res
def filter_args(command, argv, topsrcdir, topobjdir, cwd=None):
"""
Given the full list of command-line arguments, remove anything up to and including `command`,