--- a/bench.py Thu Aug 04 14:34:15 2016 +0800
+++ b/bench.py Thu Aug 04 14:39:02 2016 +0800
group.add_argument('--auto', metavar='MAXREVS', type=int, help='guess revisions, up to MAXREVS')
parser.add_argument('--marks', metavar='MARKS', default='all', help='test only these commands (comma-separated, default: all)')
parser.add_argument('--retry', action='store_true', help='try and reduce existing timings')
+parser.add_argument('--mintime', metavar='N', type=float, default=1.0, help='benchmark each command for a total of at least N seconds (default: 1.0)')
+parser.add_argument('--mintries', metavar='N', type=int, default=3, help='run each command at least N times (default: 3)')
-def test(mark, mintime=1.0, mintries=3, dropcache=True):
+def test(mark, mintime, mintries, dropcache=True):
cmd = [rel(TESTHGREPO, 'hg'), '-R', TESTREPO]
-def dbupdate(revsets, marks, retry=False):
+def dbupdate(revsets, marks, mintime, mintries, retry=False):
conn = sqlite3.connect(DBPATH)
nodes = getnodes(revsets)
- time = test(mark, dropcache=not cache)
+ time = test(mark, mintime, mintries, dropcache=not cache)
marks = OrderedDict((k, v) for k, v in MARKS.items() if k in args.marks.split(','))
- dbupdate(args.revsets, marks, args.retry)
+ dbupdate(args.revsets, marks, args.mintime, args.mintries, args.retry)