Mercurial > hg-stable
changeset 20854:bad5399c5d5f
revsetbenchmark: retrieve the benchmark value in python
We retrieve the output of the perf extension and print it ourself. This open the
door to processing of this data in the script.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 26 Mar 2014 18:39:56 -0700 |
parents | 95293cf67871 |
children | dfad9bb23ab4 |
files | contrib/revsetbenchmarks.py |
diffstat | 1 files changed, 11 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/revsetbenchmarks.py Wed Mar 26 18:36:19 2014 -0700 +++ b/contrib/revsetbenchmarks.py Wed Mar 26 18:39:56 2014 -0700 @@ -14,7 +14,7 @@ # to compare performance. import sys -from subprocess import check_call, check_output, CalledProcessError +from subprocess import check_call, check_output, CalledProcessError, STDOUT def update(rev): @@ -28,8 +28,14 @@ def perf(revset): """run benchmark for this very revset""" try: - check_call(['./hg', '--config', 'extensions.perf=contrib/perf.py', - 'perfrevset', revset]) + output = check_output(['./hg', + '--config', + 'extensions.perf=contrib/perf.py', + 'perfrevset', + revset], + stderr=STDOUT) + output = output.lstrip('!') # remove useless ! in this context + return output.strip() except CalledProcessError, exc: print >> sys.stderr, 'abort: cannot run revset benchmark' sys.exit(exc.returncode) @@ -78,8 +84,7 @@ print "----------------------------" update(r) for idx, rset in enumerate(revsets): - sys.stdout.write("%i) " % idx) - sys.stdout.flush() - perf(rset) + + print "%i)" % idx, perf(rset) print "----------------------------"