commit f50fe117b8e58157db9ed5d05713f24adf08195e
parent 40688473d8e993b71789a6b26a7e47c611d9fcf5
Author: Florian Quèze <florian@queze.net>
Date: Tue, 4 Nov 2025 10:07:38 +0000
Bug 1997671 - Upload a resource usage profile for decision tasks, r=jcristau.
Differential Revision: https://phabricator.services.mozilla.com/D270919
Diffstat:
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/taskcluster/mach_commands.py b/taskcluster/mach_commands.py
@@ -17,6 +17,7 @@ import gecko_taskgraph.main
from gecko_taskgraph.main import commands as taskgraph_commands
from mach.decorators import Command, CommandArgument, SubCommand
from mach.util import strtobool
+from mozsystemmonitor.resourcemonitor import SystemResourceMonitor
logger = logging.getLogger("taskcluster")
@@ -251,6 +252,10 @@ def taskgraph_decision(command_context, **options):
the parameters file generated by a decision task."""
try:
setup_logging(command_context)
+
+ monitor = SystemResourceMonitor(poll_interval=0.1)
+ monitor.start()
+
start = time.monotonic()
ret = taskgraph_commands["decision"].func(options)
end = time.monotonic()
@@ -278,6 +283,13 @@ def taskgraph_decision(command_context, **options):
with out_path.open("w", encoding="utf-8") as f:
json.dump(perfherder_data, f)
+ # Save resource profile
+ monitor.stop()
+ profile_path = upload_dir / "profile_build_resources.json"
+ with open(profile_path, "w", encoding="utf-8", newline="\n") as f:
+ to_write = json.dumps(monitor.as_profile(), separators=(",", ":"))
+ f.write(to_write)
+
return ret
except Exception:
traceback.print_exc()