@@ -143,21 +143,24 @@ The module defines three convenience functions and a public class:
143143 timeit.Timer('for i in range(10): oct(i)', 'gc.enable()').timeit()
144144
145145
146- .. method :: Timer.autorange(callback=None)
146+ .. method :: Timer.autorange(callback=None, target_time=None )
147147
148148 Automatically determine how many times to call :meth: `.timeit `.
149149
150150 This is a convenience function that calls :meth: `.timeit ` repeatedly
151- so that the total time >= 0.2 second , returning the eventual
151+ so that the total time >= * Timer.target_time * seconds , returning the eventual
152152 (number of loops, time taken for that number of loops). It calls
153153 :meth: `.timeit ` with increasing numbers from the sequence 1, 2, 5,
154- 10, 20, 50, ... until the time taken is at least 0.2 seconds.
154+ 10, 20, 50, ... until the time taken is at least * target_time * seconds.
155155
156156 If *callback * is given and is not ``None ``, it will be called after
157157 each trial with two arguments: ``callback(number, time_taken) ``.
158158
159159 .. versionadded :: 3.6
160160
161+ .. versionchanged :: next
162+ The optional *target_time * parameter was added.
163+
161164
162165 .. method :: Timer.repeat(repeat=5, number=1000000)
163166
@@ -239,6 +242,13 @@ Where the following options are understood:
239242
240243 .. versionadded :: 3.5
241244
245+ .. option :: -t , --target-time=T
246+
247+ if :option: `--number ` is 0, the code will run until it takes at
248+ least this many seconds (default: 0.2)
249+
250+ .. versionadded :: next
251+
242252.. option :: -v , --verbose
243253
244254 print raw timing results; repeat for more digits precision
@@ -254,7 +264,7 @@ similarly.
254264
255265If :option: `-n ` is not given, a suitable number of loops is calculated by trying
256266increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... until the total
257- time is at least 0.2 seconds .
267+ time is at least :option: ` --target-time ` seconds (default: 0.2) .
258268
259269:func: `default_timer ` measurements can be affected by other programs running on
260270the same machine, so the best thing to do when accurate timing is necessary is
0 commit comments