diff options
| author | Victor Stinner <victor.stinner@gmail.com> | 2016-09-13 09:41:41 (GMT) |
|---|---|---|
| committer | Victor Stinner <victor.stinner@gmail.com> | 2016-09-13 09:41:41 (GMT) |
| commit | 13b97e37d9d882d85b25652895f64958a42a6282 (patch) | |
| tree | 22e4b0bd61843bd7dbc69d299568e8168ec151a9 /Tools/pybench/clockres.py | |
| parent | 30386a2a366584023e20712c256fc70079e43d80 (diff) | |
| download | cpython-13b97e37d9d882d85b25652895f64958a42a6282.zip cpython-13b97e37d9d882d85b25652895f64958a42a6282.tar.gz cpython-13b97e37d9d882d85b25652895f64958a42a6282.tar.bz2 | |
Remove pybench microbenchmark
Issue #15369. Please use the new "performance" benchmark suite.
Diffstat (limited to 'Tools/pybench/clockres.py')
| -rwxr-xr-x | Tools/pybench/clockres.py | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/Tools/pybench/clockres.py b/Tools/pybench/clockres.py deleted file mode 100755 index d7f1ac8..0000000 --- a/Tools/pybench/clockres.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python - -""" clockres - calculates the resolution in seconds of a given timer. - - Copyright (c) 2006, Marc-Andre Lemburg (mal@egenix.com). See the - documentation for further information on copyrights, or contact - the author. All Rights Reserved. - -""" -import time - -TEST_TIME = 1.0 - -def clockres(timer): - d = {} - wallclock = time.time - start = wallclock() - stop = wallclock() + TEST_TIME - spin_loops = range(1000) - while 1: - now = wallclock() - if now >= stop: - break - for i in spin_loops: - d[timer()] = 1 - values = sorted(d.keys()) - min_diff = TEST_TIME - for i in range(len(values) - 1): - diff = values[i+1] - values[i] - if diff < min_diff: - min_diff = diff - return min_diff - -if __name__ == '__main__': - print('Clock resolution of various timer implementations:') - print('time.clock: %10.3fus' % (clockres(time.clock) * 1e6)) - print('time.time: %10.3fus' % (clockres(time.time) * 1e6)) - try: - import systimes - print('systimes.processtime: %10.3fus' % (clockres(systimes.processtime) * 1e6)) - except ImportError: - pass |
