diff options
| author | spreis <[email protected]> | 2026-06-15 11:04:38 +0300 |
|---|---|---|
| committer | spreis <[email protected]> | 2026-06-15 11:27:08 +0300 |
| commit | 03c4def7658a9ce2bcf05bd4e9feee83d89d3fe6 (patch) | |
| tree | d53ced74401e5a000643cc23b94363f940f7e445 | |
| parent | f49b3776011d949e30289a135bf7ab10bfb7823c (diff) | |
Aggregate clang-tidy metrics
commit_hash:a8994274757635fd3a37114db47a7cf2db9c3cb8
| -rw-r--r-- | build/scripts/clang_tidy.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/build/scripts/clang_tidy.py b/build/scripts/clang_tidy.py index fce6815f4ad..1bf699a405e 100644 --- a/build/scripts/clang_tidy.py +++ b/build/scripts/clang_tidy.py @@ -8,6 +8,8 @@ import sys import subprocess +from collections import defaultdict + load_yaml = None @@ -123,6 +125,25 @@ def find_header(p, h): raise Exception('can not find inc dir') +def compact_profile(profile): + PREFIX = 'time.clang-tidy.' + SUFFIX = '.wall' + + # Metrics look like: + # 'time.clang-tidy.performance-implicit-conversion-in-loop.wall': 1.9073486328125e-06, + # 'time.clang-tidy.performance-implicit-conversion-in-loop.user': 1.0000000000001327e-06 + # So (1), leave just wall, (2) sum by 1st word of name, and (3) round to 3 digits after '.' + grouped_sums = defaultdict(float) + for key, value in profile.items(): + if key.startswith(PREFIX) and key.endswith(SUFFIX): + metric_full_name = key[len(PREFIX) : -len(SUFFIX)] + group_name = metric_full_name.split('-')[0] + group_key = f"{PREFIX}{group_name}{SUFFIX}" + grouped_sums[group_key] += value + + return {k: round(v, 3) for k, v in grouped_sums.items()} + + def main(): args, clang_cmd = parse_args() if '-gz=zstd' in clang_cmd: @@ -198,7 +219,7 @@ def main(): { "file": testing_src, "exit_code": res.returncode, - "profile": profile, + "profile": compact_profile(profile), "stderr": err, "stdout": out, "fixes": tidy_fixes, |
