Lines Matching +full:repeat +full:- +full:string
12 python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [-h] [--] [statement]
15 -n/--number N: how many times to execute 'statement' (default: see below)
16 -r/--repeat N: how many times to repeat the timer (default 3)
17 -s/--setup S: statement to be executed once initially (default 'pass')
18 -t/--time: use time.time() (default on Unix)
19 -c/--clock: use time.clock() (default on Windows)
20 -v/--verbose: print raw timing results; repeat for more digits precision
21 -h/--help: print this usage message and exit
22 --: separate options from statement, use when statement starts with -
25 A multi-line statement may be given by specifying each line as a
27 argument in quotes and using leading spaces. Multiple -s options are
30 If -n is not given, a suitable number of loops is calculated by trying
40 repeat the timing a few times and use the best time. The -r option is
51 use python -O for the older versions to avoid timing SET_LINENO
66 dummy_src_name = "<timeit-src>"
87 return _t1 - _t0
91 """Helper to reindent a multi-line statement."""
102 return _t1 - _t0
110 default to 'pass'; the timer function is platform-dependent (see
111 module doc string).
114 timeit() method. The repeat() method is a convenience to call
118 multi-line string literals.
122 """Constructor. See class doc string."""
141 raise ValueError("setup is neither a string nor callable")
153 raise ValueError("setup is neither a string nor callable")
156 raise ValueError("stmt is neither a string nor callable")
165 t.timeit(...) # or t.repeat(...)
196 it = itertools.repeat(None, number)
208 def repeat(self, repeat=default_repeat, number=default_number): member in Timer
229 for i in range(repeat):
239 def repeat(stmt="pass", setup="pass", timer=default_timer, argument
240 repeat=default_repeat, number=default_number):
241 """Convenience function to create Timer object and call repeat method."""
242 return Timer(stmt, setup, timer).repeat(repeat, number)
266 ["number=", "setup=", "repeat=",
270 print "use -h/--help for command line help"
274 number = 0 # auto-determine
276 repeat = default_repeat
280 if o in ("-n", "--number"):
282 if o in ("-s", "--setup"):
284 if o in ("-r", "--repeat"):
285 repeat = int(a)
286 if repeat <= 0:
287 repeat = 1
288 if o in ("-t", "--time"):
290 if o in ("-c", "--clock"):
292 if o in ("-v", "--verbose"):
296 if o in ("-h", "--help"):
318 print "%d loops -> %.*g secs" % (number, precision, x)
322 r = t.repeat(repeat, number)
332 print "best of %d: %.*g usec per loop" % (repeat, precision, usec)
336 print "best of %d: %.*g msec per loop" % (repeat, precision, msec)
339 print "best of %d: %.*g sec per loop" % (repeat, precision, sec)