diff options
author | Ori Bernstein <ori@eigenstate.org> | 2021-06-14 00:00:37 +0000 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2021-06-14 00:00:37 +0000 |
commit | a73a964e51247ed169d322c725a3a18859f109a3 (patch) | |
tree | 3f752d117274d444bda44e85609aeac1acf313f3 /sys/src/cmd/python/Tools/pybench/clockres.py | |
parent | e64efe273fcb921a61bf27d33b230c4e64fcd425 (diff) |
python, hg: tow outside the environment.
they've served us well, and can ride off into the sunset.
Diffstat (limited to 'sys/src/cmd/python/Tools/pybench/clockres.py')
-rw-r--r-- | sys/src/cmd/python/Tools/pybench/clockres.py | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/sys/src/cmd/python/Tools/pybench/clockres.py b/sys/src/cmd/python/Tools/pybench/clockres.py deleted file mode 100644 index 64095b3a5..000000000 --- a/sys/src/cmd/python/Tools/pybench/clockres.py +++ /dev/null @@ -1,43 +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 = d.keys() - values.sort() - 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 |