forked from mirrors/gecko-dev
Bug 1859733 - Parse profile_build_resources.json instead of build_resources.json. r=releng-reviewers,gbrown
Differential Revision: https://phabricator.services.mozilla.com/D191376
This commit is contained in:
parent
38875f2a2b
commit
499299574f
2 changed files with 21 additions and 12 deletions
|
|
@ -1001,16 +1001,27 @@ items from that key's value."
|
|||
return False
|
||||
|
||||
def _load_build_resources(self):
|
||||
p = self.config.get("build_resources_path") % self.query_abs_dirs()
|
||||
p = self.config.get("profile_build_resources_path") % self.query_abs_dirs()
|
||||
if not os.path.exists(p):
|
||||
self.info("%s does not exist; not loading build resources" % p)
|
||||
self.info("%s does not exist; not loading build profile data" % p)
|
||||
return None
|
||||
|
||||
with open(p, "r") as fh:
|
||||
resources = json.load(fh)
|
||||
profile = json.load(fh)
|
||||
|
||||
if "duration" not in resources:
|
||||
self.info("resource usage lacks duration; ignoring")
|
||||
try:
|
||||
thread = profile.get("threads", [])[0]
|
||||
times = thread.get("samples", {}).get("time", [])
|
||||
duration = times[-1] / 1000
|
||||
markers = thread["markers"]
|
||||
phases = {}
|
||||
for n, marker in enumerate(markers["data"]):
|
||||
if marker.get("type") == "Phase":
|
||||
phases[marker["phase"]] = (
|
||||
markers["endTime"][n] - markers["startTime"][n]
|
||||
) / 1000
|
||||
except Exception:
|
||||
self.info("build profile lacks data; ignoring")
|
||||
return None
|
||||
|
||||
# We want to always collect metrics. But alerts with sccache enabled
|
||||
|
|
@ -1019,19 +1030,17 @@ items from that key's value."
|
|||
|
||||
data = {
|
||||
"name": "build times",
|
||||
"value": resources["duration"],
|
||||
"value": duration,
|
||||
"extraOptions": self.perfherder_resource_options(),
|
||||
"shouldAlert": should_alert,
|
||||
"subtests": [],
|
||||
}
|
||||
|
||||
for phase in resources["phases"]:
|
||||
if "duration" not in phase:
|
||||
continue
|
||||
for name, duration in phases.items():
|
||||
data["subtests"].append(
|
||||
{
|
||||
"name": phase["name"],
|
||||
"value": phase["duration"],
|
||||
"name": name,
|
||||
"value": duration,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class FxDesktopBuild(BuildScript, object):
|
|||
# jobs have a minimal `hg pull`.
|
||||
"clone_upstream_url": "https://hg.mozilla.org/mozilla-unified",
|
||||
"repo_base": "https://hg.mozilla.org",
|
||||
"build_resources_path": "%(upload_path)s/build_resources.json",
|
||||
"profile_build_resources_path": "%(upload_path)s/profile_build_resources.json",
|
||||
"nightly_promotion_branches": ["mozilla-central", "mozilla-aurora"],
|
||||
# try will overwrite these
|
||||
"clone_with_purge": False,
|
||||
|
|
|
|||
Loading…
Reference in a new issue