summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorGeorge Karpenkov <ekarpenkov@apple.com>2018-10-23 01:30:26 +0000
committerGeorge Karpenkov <ekarpenkov@apple.com>2018-10-23 01:30:26 +0000
commit251cc4f6acd8f94572e1db2e9a113695efbde145 (patch)
tree3cd1ec66047cebb3638d54fbb73451713fcd844b /utils
parent8377fd8a5d4e0722e2e7c155cfd7649dd4fc2ce9 (diff)
[analyzer] [testing] Compute data on path length, compute percentiles
Differential Revision: https://reviews.llvm.org/D52844 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344990 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rwxr-xr-xutils/analyzer/CmpRuns.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/utils/analyzer/CmpRuns.py b/utils/analyzer/CmpRuns.py
index 7c9744727e..ab8c48b023 100755
--- a/utils/analyzer/CmpRuns.py
+++ b/utils/analyzer/CmpRuns.py
@@ -281,9 +281,21 @@ def compareResults(A, B, opts):
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 @@ def deriveStats(results):
"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)
}