Improve presentation of aggregate results in mojo_benchmark. This prints median, mean and std-dev of each measurement when running with `--aggregate`. R=qsr@chromium.org Review URL: https://codereview.chromium.org/1442623002 . Cr-Mirrored-From: https://github.com/domokit/mojo Cr-Mirrored-Commit: 70faf5f60271f65f8984646751bccdf74ddcedf6
diff --git a/mojo_benchmark b/mojo_benchmark index 9a4803c..e01ff62 100755 --- a/mojo_benchmark +++ b/mojo_benchmark
@@ -7,6 +7,7 @@ import argparse import logging +import numpy import sys import time @@ -70,6 +71,16 @@ print '-' * 72 +def _format_vector(results): + if not len(results): + return "med -, avg -, std-dev -, (no results)" + + return "med %f, avg %f, std-dev %f %s" % (numpy.median(results), + numpy.mean(results), + numpy.std(results), + str(results)) + + def _print_results(benchmark_name, variant_name, results, measurements, aggregate): print '[ %s ] %s ' % (benchmark_name, variant_name) @@ -77,7 +88,7 @@ print ' ' + measurement['name'] + ': ', if measurement['spec'] in results: if aggregate: - print str(results[measurement['spec']]) + print _format_vector(results[measurement['spec']]) else: if len(results[measurement['spec']]) == 0: print '?'