diff options
author | Usta (Tsering) Shrestha <usta@google.com> | 2023-04-18 01:06:27 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2023-04-18 01:06:27 +0000 |
commit | 50f7e3212f41621f8fd7441e79bf056a15833656 (patch) | |
tree | 14a544b119891edd607c751f422905df93496ebe /scripts/incremental_build/perf_metrics.py | |
parent | 8bbd1f3b3067f3f4d137e92641bd60312c9f5129 (diff) | |
parent | 4ab91fa0cb077832d9ae57c89097347258526212 (diff) | |
download | bazel-50f7e3212f41621f8fd7441e79bf056a15833656.tar.gz |
Merge changes I6773b80c,I9b81bbf7
* changes:
Fix event ordering in perf script
cosmetic: use os.walkdir()
Diffstat (limited to 'scripts/incremental_build/perf_metrics.py')
-rw-r--r-- | scripts/incremental_build/perf_metrics.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/incremental_build/perf_metrics.py b/scripts/incremental_build/perf_metrics.py index 3d074566..64512e73 100644 --- a/scripts/incremental_build/perf_metrics.py +++ b/scripts/incremental_build/perf_metrics.py @@ -181,10 +181,12 @@ def _get_column_headers(rows: list[Row], allow_cycles: bool) -> list[str]: prev_col = all_cols[col] acc = [] - while len(all_cols) > 0: - entries = [c for c in all_cols.values()] - entries.sort(key=lambda c: f'{c.indegree:03d}{c.header}') - entry = entries[0] + entries = [c for c in all_cols.values()] + while len(entries) > 0: + # sorting alphabetically to break ties for concurrent events + entries.sort(key=lambda c: c.header, reverse=True) + entries.sort(key=lambda c: c.indegree, reverse=True) + entry = entries.pop() # take only one to maintain alphabetical sort if entry.indegree != 0: cycle = '->'.join(entry.dfs(entry.header)) @@ -200,7 +202,6 @@ def _get_column_headers(rows: list[Row], allow_cycles: bool) -> list[str]: else: if not allow_cycles: raise ValueError(f'unexpected error for: {n}') - all_cols.pop(entry.header) return acc |