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

Unified Diff: tools/eval_gc_nvp.py

Issue 1405903003: [tools] Add ranking to GC NVP eval script (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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 | no next file » | 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 8a9b8e70728cc58c53970cc4f8184d18a486a543..f18a579391c2f95bdfb2bd2e03ef94b7953acc19 100755
--- a/tools/eval_gc_nvp.py
+++ b/tools/eval_gc_nvp.py
@@ -85,6 +85,15 @@ class Category:
if self.histogram:
self.histogram.add(float(entry[self.key]))
+ def min(self):
+ return min(self.values)
+
+ def max(self):
+ return max(self.values)
+
+ def avg(self):
+ return sum(self.values) / len(self.values)
+
def __str__(self):
ret = [self.key]
ret.append(" len: {0}".format(len(self.values)))
@@ -96,6 +105,15 @@ class Category:
ret.append(str(self.histogram))
return "\n".join(ret)
+ def __repr__(self):
+ return "<Category: {0}>".format(self.key)
+
+
+def make_key_func(cmp_metric):
+ def key_func(a):
+ return getattr(a, cmp_metric)()
+ return key_func
+
def main():
parser = ArgumentParser(description="Process GCTracer's NVP output")
@@ -121,6 +139,10 @@ def main():
action='store_false', help='do not print histogram')
parser.set_defaults(histogram=True)
parser.set_defaults(histogram_omit_empty=False)
+ parser.add_argument('--rank', metavar='<no|min|max|avg>',
+ type=str, nargs='?',
+ default="no",
+ help="rank keys by metric (default: no)")
args = parser.parse_args()
histogram = None
@@ -143,6 +165,9 @@ def main():
for category in categories:
category.process_entry(obj)
+ if args.rank != "no":
+ categories = sorted(categories, key=make_key_func(args.rank), reverse=True)
+
for category in categories:
print(category)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698