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

Unified Diff: tools/eval_gc_nvp.py

Issue 1846983002: [tools] Beef up GC eval scripts (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 f18a579391c2f95bdfb2bd2e03ef94b7953acc19..af131f182fc52f71b8b741c43bcba05d60b3bf06 100755
--- a/tools/eval_gc_nvp.py
+++ b/tools/eval_gc_nvp.py
@@ -74,10 +74,11 @@ class Histogram:
class Category:
- def __init__(self, key, histogram):
+ def __init__(self, key, histogram, csv):
self.key = key
self.values = []
self.histogram = histogram
+ self.csv = csv
def process_entry(self, entry):
if self.key in entry:
@@ -92,18 +93,29 @@ class Category:
return max(self.values)
def avg(self):
+ if len(self.values) == 0:
+ return 0.0
return sum(self.values) / len(self.values)
def __str__(self):
- ret = [self.key]
- ret.append(" len: {0}".format(len(self.values)))
- if len(self.values) > 0:
- ret.append(" min: {0}".format(min(self.values)))
- ret.append(" max: {0}".format(max(self.values)))
- ret.append(" avg: {0}".format(sum(self.values) / len(self.values)))
- if self.histogram:
- ret.append(str(self.histogram))
- return "\n".join(ret)
+ if self.csv:
+ ret = [self.key]
+ ret.append(len(self.values))
+ ret.append(self.min())
+ ret.append(self.max())
+ ret.append(self.avg())
+ ret = [str(x) for x in ret]
+ return ",".join(ret)
+ else:
+ ret = [self.key]
+ ret.append(" len: {0}".format(len(self.values)))
+ if len(self.values) > 0:
+ ret.append(" min: {0}".format(self.min()))
+ ret.append(" max: {0}".format(self.max()))
+ ret.append(" avg: {0}".format(self.avg()))
+ if self.histogram:
+ ret.append(str(self.histogram))
+ return "\n".join(ret)
def __repr__(self):
return "<Category: {0}>".format(self.key)
@@ -143,6 +155,8 @@ def main():
type=str, nargs='?',
default="no",
help="rank keys by metric (default: no)")
+ parser.add_argument('--csv', dest='csv',
+ action='store_true', help='provide output as csv')
args = parser.parse_args()
histogram = None
@@ -154,7 +168,7 @@ def main():
bucket_trait = LinearBucket(args.linear_histogram_granularity)
histogram = Histogram(bucket_trait, not args.histogram_omit_empty)
- categories = [ Category(key, deepcopy(histogram))
+ categories = [ Category(key, deepcopy(histogram), args.csv)
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