@@ -48,20 +48,23 @@ def hg(cmd, repo=None):
fullcmd = ['./hg']
if repo is not None:
fullcmd += ['-R', repo]
fullcmd += ['--config',
'extensions.perf=' + os.path.join(contribdir, 'perf.py')]
fullcmd += cmd
return check_output(fullcmd, stderr=STDOUT)
-def perf(revset, target=None):
+def perf(revset, target=None, contexts=False):
"""run benchmark for this very revset"""
try:
- output = hg(['perfrevset', revset], repo=target)
+ args = ['perfrevset', revset]
+ if contexts:
+ args.append('--contexts')
+ output = hg(args, repo=target)
return parseoutput(output)
except CalledProcessError as exc:
print >> sys.stderr, 'abort: cannot run revset benchmark: %s' % exc.cmd
if exc.output is None:
print >> sys.stderr, '(no output)'
else:
print >> sys.stderr, exc.output
return None
@@ -233,16 +236,19 @@ parser.add_option("-R", "--repo",
parser.add_option("-v", "--verbose",
action='store_true',
help="display all timing data (not just best total time)")
parser.add_option("", "--variants",
default=','.join(DEFAULTVARIANTS),
help="comma separated list of variant to test "
"(eg: plain,min,sorted) (plain = no modification)")
+parser.add_option('-x', '--contexts',
+ action='store_true',
+ help='obtain changectx from results instead of integer revs')
(options, args) = parser.parse_args()
if not args:
parser.print_help()
sys.exit(255)
# the directory where both this script and the perf.py extension live.
@@ -278,17 +284,17 @@ for r in revs:
update(r)
res = []
results.append(res)
printheader(variants, len(revsets), verbose=options.verbose)
for idx, rset in enumerate(revsets):
varres = {}
for var in variants:
varrset = applyvariants(rset, var)
- data = perf(varrset, target=options.repo)
+ data = perf(varrset, target=options.repo, contexts=options.contexts)
varres[var] = data
res.append(varres)
printresult(variants, idx, varres, len(revsets),
verbose=options.verbose)
sys.stdout.flush()
print "----------------------------"