Download:
child 79:3adb8b3de974
parent 77:c4a6cb0ec67c
78:362eb6642d17
Anton Shestakov <av6@dwimlabs.net>, Thu, 04 Aug 2016 14:39:02 +0800
bench: expose time()'s mintime and mintries arguments as command line options

1 файлов изменено, 6 вставок(+), 4 удалений(-) [+]
bench.py file | annotate | diff | comparison | revisions
--- a/bench.py Thu Aug 04 14:34:15 2016 +0800
+++ b/bench.py Thu Aug 04 14:39:02 2016 +0800
@@ -35,9 +35,11 @@
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):
results = []
cmd = [rel(TESTHGREPO, 'hg'), '-R', TESTREPO]
@@ -191,7 +193,7 @@
conn.close()
-def dbupdate(revsets, marks, retry=False):
+def dbupdate(revsets, marks, mintime, mintries, retry=False):
conn = sqlite3.connect(DBPATH)
makeclean()
nodes = getnodes(revsets)
@@ -216,7 +218,7 @@
makelocal(node)
madelocal = True
- time = test(mark, dropcache=not cache)
+ time = test(mark, mintime, mintries, dropcache=not cache)
if time is None:
status = 'noop'
elif oldtime is None:
@@ -279,7 +281,7 @@
marks = MARKS
else:
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)
finally:
unlock()