Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Unified Diff: tools/eval_gc_nvp.py

Issue 1869353002: [tools] Compute percentiles for GC NVP (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/eval_gc_time.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/eval_gc_nvp.py
diff --git a/tools/eval_gc_nvp.py b/tools/eval_gc_nvp.py
index fcb6d8b9a2232ff24b04709d9520df0bd0b61755..25afe8e4f0a74a6aed84524e85ec6c66f0bfeb91 100755
--- a/tools/eval_gc_nvp.py
+++ b/tools/eval_gc_nvp.py
@@ -10,7 +10,7 @@
from argparse import ArgumentParser
from copy import deepcopy
from gc_nvp_common import split_nvp
-from math import log
+from math import ceil,log
from sys import stdin
@@ -74,11 +74,12 @@ class Histogram:
class Category:
- def __init__(self, key, histogram, csv):
+ def __init__(self, key, histogram, csv, percentiles):
self.key = key
self.values = []
self.histogram = histogram
self.csv = csv
+ self.percentiles = percentiles
def process_entry(self, entry):
if self.key in entry:
@@ -100,6 +101,16 @@ class Category:
def empty(self):
return len(self.values) == 0
+ def _compute_percentiles(self):
+ ret = []
+ if len(self.values) == 0:
+ return ret
+ sorted_values = sorted(self.values)
+ for percentile in self.percentiles:
+ index = int(ceil((len(self.values) - 1) * percentile / 100))
+ ret.append(" {0}%: {1}".format(percentile, sorted_values[index]))
+ return ret
+
def __str__(self):
if self.csv:
ret = [self.key]
@@ -118,6 +129,8 @@ class Category:
ret.append(" avg: {0}".format(self.avg()))
if self.histogram:
ret.append(str(self.histogram))
+ if self.percentiles:
+ ret.append("\n".join(self._compute_percentiles()))
return "\n".join(ret)
def __repr__(self):
@@ -160,6 +173,9 @@ def main():
help="rank keys by metric (default: no)")
parser.add_argument('--csv', dest='csv',
action='store_true', help='provide output as csv')
+ parser.add_argument('--percentiles', dest='percentiles',
+ type=str, default="",
+ help='comma separated list of percentiles')
args = parser.parse_args()
histogram = None
@@ -171,7 +187,14 @@ def main():
bucket_trait = LinearBucket(args.linear_histogram_granularity)
histogram = Histogram(bucket_trait, not args.histogram_omit_empty)
- categories = [ Category(key, deepcopy(histogram), args.csv)
+ percentiles = []
+ for percentile in args.percentiles.split(','):
+ try:
+ percentiles.append(float(percentile))
+ except ValueError:
+ pass
+
+ categories = [ Category(key, deepcopy(histogram), args.csv, percentiles)
for key in args.keys ]
while True:
« no previous file with comments | « no previous file | tools/eval_gc_time.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698