aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2025-07-10 11:45:25 +0100
committerAlex Bennée <alex.bennee@linaro.org>2025-07-14 11:42:39 +0100
commit17c2c399bdf75c314bfce97fb9fb21badc9e4465 (patch)
tree85e89c194c4f56889a95a202cf9e6aee5b3dd06a
parent5ad6432880959ca373d62d715de8f0e2ca507a38 (diff)
downloadqemu-17c2c399bdf75c314bfce97fb9fb21badc9e4465.zip
qemu-17c2c399bdf75c314bfce97fb9fb21badc9e4465.tar.gz
qemu-17c2c399bdf75c314bfce97fb9fb21badc9e4465.tar.bz2
gitlab: add -n option to check-units script
Mostly a developer aid for those who want to look at the full backlog of multiple build units. Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-ID: <20250710104531.3099313-3-alex.bennee@linaro.org>
-rwxr-xr-x.gitlab-ci.d/check-units.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/.gitlab-ci.d/check-units.py b/.gitlab-ci.d/check-units.py
index cdc62ae..cebef0e 100755
--- a/.gitlab-ci.d/check-units.py
+++ b/.gitlab-ci.d/check-units.py
@@ -30,7 +30,7 @@ def extract_build_units(cc_path):
return build_units
-def analyse_units(build_units):
+def analyse_units(build_units, top_n):
"""
Analyse the build units and report stats and the top 10 rebuilds
"""
@@ -44,7 +44,7 @@ def analyse_units(build_units):
reverse=True)
print("Most rebuilt units:")
- for unit, count in sorted_build_units[:20]:
+ for unit, count in sorted_build_units[:top_n]:
print(f" {unit} built {count} times")
print("Least rebuilt units:")
@@ -57,12 +57,14 @@ if __name__ == "__main__":
description="analyse number of build units in compile_commands.json")
parser.add_argument("cc_path", type=Path, default=None,
help="Path to compile_commands.json")
+ parser.add_argument("-n", type=int, default=20,
+ help="Dump the top <n> entries")
args = parser.parse_args()
if path.isfile(args.cc_path) and access(args.cc_path, R_OK):
units = extract_build_units(args.cc_path)
- analyse_units(units)
+ analyse_units(units, args.n)
exit(0)
else:
print(f"{args.cc_path} doesn't exist or isn't readable")