[PATCH] D81642: [analyzer] CmpRuns.py: Fix error due to statistics differences
Valeriy Savchenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 16 03:50:42 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4a606e0a8c8f: [analyzer] CmpRuns.py: Fix error due to statistics differences (authored by vsavchenko).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81642/new/
https://reviews.llvm.org/D81642
Files:
clang/utils/analyzer/CmpRuns.py
Index: clang/utils/analyzer/CmpRuns.py
===================================================================
--- clang/utils/analyzer/CmpRuns.py
+++ clang/utils/analyzer/CmpRuns.py
@@ -398,16 +398,18 @@
stats_old = derive_stats(results_old)
stats_new = derive_stats(results_new)
- keys = sorted(stats_old.keys())
+ old_keys = set(stats_old.keys())
+ new_keys = set(stats_new.keys())
+ keys = sorted(old_keys & new_keys)
- # FIXME: stats_old and stats_new are not necessarily sharing all of their
- # stats and can crash when stats_new doesn't have/removed some
for key in keys:
print(key)
- for kkey in stats_old[key]:
- val_old = float(stats_old[key][kkey])
- val_new = float(stats_new[key][kkey])
+ nested_keys = sorted(set(stats_old[key]) & set(stats_new[key]))
+
+ for nested_key in nested_keys:
+ val_old = float(stats_old[key][nested_key])
+ val_new = float(stats_new[key][nested_key])
report = f"{val_old:.3f} -> {val_new:.3f}"
@@ -420,7 +422,17 @@
elif ratio > 0.2:
report = Colors.RED + report + Colors.CLEAR
- print(f"\t {kkey} {report}")
+ print(f"\t {nested_key} {report}")
+
+ removed_keys = old_keys - new_keys
+ if removed_keys:
+ print(f"REMOVED statistics: {removed_keys}")
+
+ added_keys = new_keys - old_keys
+ if added_keys:
+ print(f"ADDED statistics: {added_keys}")
+
+ print()
def dump_scan_build_results_diff(dir_old: str, dir_new: str,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81642.271025.patch
Type: text/x-patch
Size: 1600 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200616/6cec89cf/attachment.bin>
More information about the cfe-commits
mailing list