##// 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 check_call(['hg', 'log', '--rev', str(rev), '--template',
92 check_call(['hg', 'log', '--rev', str(rev), '--template',
93 '{desc|firstline}\n'])
93 '{desc|firstline}\n'])
94
94
95 def formatresult(data):
95 def printresult(idx, data, maxidx):
96 """format the data dict into a line of text for humans"""
96 """print a line of result to stdout"""
97 return ("wall %f comb %f user %f sys %f (best of %d)"
97 mask = '%i) %s'
98 % (data['wall'], data['comb'], data['user'],
99 data['sys'], data['count']))
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 def getrevs(spec):
105 def getrevs(spec):
103 """get the list of rev matched by a revset"""
106 """get the list of rev matched by a revset"""
@@ -156,7 +159,7 b' for r in revs:'
156 for idx, rset in enumerate(revsets):
159 for idx, rset in enumerate(revsets):
157 data = perf(rset, target=options.repo)
160 data = perf(rset, target=options.repo)
158 res.append(data)
161 res.append(data)
159 print "%i)" % idx, formatresult(data)
162 printresult(idx, data, len(revsets))
160 sys.stdout.flush()
163 sys.stdout.flush()
161 print "----------------------------"
164 print "----------------------------"
162
165
@@ -180,5 +183,5 b' for ridx, rset in enumerate(revsets):'
180
183
181 print "revset #%i: %s" % (ridx, rset)
184 print "revset #%i: %s" % (ridx, rset)
182 for idx, data in enumerate(results):
185 for idx, data in enumerate(results):
183 print '%i) %s' % (idx, formatresult(data[ridx]))
186 printresult(idx, data[ridx], len(results))
184 print
187 print
General Comments 0
You need to be logged in to leave comments. Login now