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)
         }


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)
         }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to