diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2012-04-29 01:01:20 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2012-04-29 01:01:20 (GMT) |
commit | fe98e2fc8391607fc1cae235a49bbafc65a822f0 (patch) | |
tree | e00cb1f63634a8361ebd60c3a496a163e5d66c59 /Lib/test/reperf.py | |
parent | 47620a661128ce91f46f01fb46e1326880365e75 (diff) | |
download | cpython-fe98e2fc8391607fc1cae235a49bbafc65a822f0.zip cpython-fe98e2fc8391607fc1cae235a49bbafc65a822f0.tar.gz cpython-fe98e2fc8391607fc1cae235a49bbafc65a822f0.tar.bz2 |
Issue #14428: Use the new time.perf_counter() and time.process_time() functions
* Replace "time.clock on windows, or time.time" with time.perf_counter()
* profile module: only use time.process_time() instead of trying different
functions providing the process time
* timeit module: use time.perf_counter() by default, time.time() and
time.clock() can still be used using --time and --clock options
* pybench program: use time.perf_counter() by default, add support for
the new time.process_time() and time.perf_counter() functions, but stay
backward compatible. Use also time.get_clock_info() to display information
of the timer.
Diffstat (limited to 'Lib/test/reperf.py')
-rw-r--r-- | Lib/test/reperf.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/reperf.py b/Lib/test/reperf.py index 7c68234..e93bacd 100644 --- a/Lib/test/reperf.py +++ b/Lib/test/reperf.py @@ -9,13 +9,13 @@ def main(): timefunc(10, p.findall, s) def timefunc(n, func, *args, **kw): - t0 = time.clock() + t0 = time.perf_counter() try: for i in range(n): result = func(*args, **kw) return result finally: - t1 = time.clock() + t1 = time.perf_counter() if n > 1: print(n, "times", end=' ') print(func.__name__, "%.3f" % (t1-t0), "CPU seconds") |