##// END OF EJS Templates
revsetbenchmarks: factor out result output into a function...
Pierre-Yves David -
r25531:371d8afc default
parent child Browse files
Show More
@@ -92,12 +92,15 b' def printrevision(rev):'
92 92 check_call(['hg', 'log', '--rev', str(rev), '--template',
93 93 '{desc|firstline}\n'])
94 94
95 def formatresult(data):
96 """format the data dict into a line of text for humans"""
97 return ("wall %f comb %f user %f sys %f (best of %d)"
98 % (data['wall'], data['comb'], data['user'],
99 data['sys'], data['count']))
95 def printresult(idx, data, maxidx):
96 """print a line of result to stdout"""
97 mask = '%i) %s'
100 98
99 out = ("wall %f comb %f user %f sys %f (best of %d)"
100 % (data['wall'], data['comb'], data['user'],
101 data['sys'], data['count']))
102
103 print mask % (idx, out)
101 104
102 105 def getrevs(spec):
103 106 """get the list of rev matched by a revset"""
@@ -156,7 +159,7 b' for r in revs:'
156 159 for idx, rset in enumerate(revsets):
157 160 data = perf(rset, target=options.repo)
158 161 res.append(data)
159 print "%i)" % idx, formatresult(data)
162 printresult(idx, data, len(revsets))
160 163 sys.stdout.flush()
161 164 print "----------------------------"
162 165
@@ -180,5 +183,5 b' for ridx, rset in enumerate(revsets):'
180 183
181 184 print "revset #%i: %s" % (ridx, rset)
182 185 for idx, data in enumerate(results):
183 print '%i) %s' % (idx, formatresult(data[ridx]))
186 printresult(idx, data[ridx], len(results))
184 187 print
General Comments 0
You need to be logged in to leave comments. Login now