[PATCH] D52844: [analyzer] [testing] Compute data on path length, compute percentiles

George Karpenkov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 22 18:32:31 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC344990: [analyzer] [testing] Compute data on path length, compute percentiles (authored by george.karpenkov, committed by ).
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D52844?vs=168160&id=170556#toc

Repository:
  rC Clang

https://reviews.llvm.org/D52844

Files:
  utils/analyzer/CmpRuns.py


Index: utils/analyzer/CmpRuns.py
===================================================================
--- utils/analyzer/CmpRuns.py
+++ utils/analyzer/CmpRuns.py
@@ -281,9 +281,21 @@
 
     return res
 
+def computePercentile(l, percentile):
+    """
+    Return computed percentile.
+    """
+    return sorted(l)[int(round(percentile * len(l) + 0.5)) - 1]
+
 def deriveStats(results):
     # Assume all keys are the same in each statistics bucket.
     combined_data = defaultdict(list)
+
+    # Collect data on paths length.
+    for report in results.reports:
+        for diagnostic in report.diagnostics:
+            combined_data['PathsLength'].append(diagnostic.getPathLength())
+
     for stat in results.stats:
         for key, value in stat.iteritems():
             combined_data[key].append(value)
@@ -293,6 +305,8 @@
             "max": max(values),
             "min": min(values),
             "mean": sum(values) / len(values),
+            "90th %tile": computePercentile(values, 0.9),
+            "95th %tile": computePercentile(values, 0.95),
             "median": sorted(values)[len(values) / 2],
             "total": sum(values)
         }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52844.170556.patch
Type: text/x-patch
Size: 1166 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181023/236fd189/attachment.bin>


More information about the cfe-commits mailing list