# HG changeset patch # User Pierre-Yves David # Date 2015-06-10 00:15:48 # Node ID 43e5a6819abab367eedd0e555289d0dfd86c2711 # Parent 4bdf6f58aee1a88dedca7c88c866ee2e5f25f3b6 revsetbenchmarks: use a more compact output format with a header We change the output from: revset #0: draft() 0) wall 0.011989 comb 0.010000 user 0.000000 sys 0.010000 (best of 177) 1) wall 0.012226 comb 0.010000 user 0.000000 sys 0.010000 (best of 193) 2) wall 0.011838 comb 0.020000 user 0.000000 sys 0.020000 (best of 208) to: revset #0: draft() wall comb user sys count 0) 0.012028 0.010000 0.000000 0.010000 170 1) 0.012218 0.010000 0.000000 0.010000 157 2) 0.012622 0.010000 0.000000 0.010000 189 This opens the road to more useful output. diff --git a/contrib/revsetbenchmarks.py b/contrib/revsetbenchmarks.py --- a/contrib/revsetbenchmarks.py +++ b/contrib/revsetbenchmarks.py @@ -111,12 +111,23 @@ def idxwidth(nbidx): def printresult(idx, data, maxidx): """print a line of result to stdout""" mask = '%%0%ii) %%s' % idxwidth(maxidx) + out = ['%10.6f' % data['wall'], + '%10.6f' % data['comb'], + '%10.6f' % data['user'], + '%10.6f' % data['sys'], + '%6d' % data['count'], + ] + print mask % (idx, ' '.join(out)) - out = ("wall %f comb %f user %f sys %f (best of %d)" - % (data['wall'], data['comb'], data['user'], - data['sys'], data['count'])) - - print mask % (idx, out) +def printheader(maxidx): + header = [' ' * (idxwidth(maxidx) + 1), + ' %-8s' % 'wall', + ' %-8s' % 'comb', + ' %-8s' % 'user', + ' %-8s' % 'sys', + '%6s' % 'count', + ] + print ' '.join(header) def getrevs(spec): """get the list of rev matched by a revset""" @@ -172,6 +183,7 @@ for r in revs: update(r) res = [] results.append(res) + printheader(len(revsets)) for idx, rset in enumerate(revsets): data = perf(rset, target=options.repo) res.append(data) @@ -198,6 +210,7 @@ print for ridx, rset in enumerate(revsets): print "revset #%i: %s" % (ridx, rset) + printheader(len(results)) for idx, data in enumerate(results): printresult(idx, data[ridx], len(results)) print