mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Show microseconds, milliseconds or seconds, whichever is most natural,
rather than showing weird numbers like 8.4e+03 usec.
This commit is contained in:
parent
0c9a318d64
commit
571720811b
1 changed files with 9 additions and 1 deletions
|
|
@ -264,7 +264,15 @@ def main(args=None):
|
|||
print "raw times:", " ".join(["%.*g" % (precision, x) for x in r])
|
||||
print "%d loops," % number,
|
||||
usec = best * 1e6 / number
|
||||
print "best of %d: %.*g usec per loop" % (repeat, precision, usec)
|
||||
if usec < 1000:
|
||||
print "best of %d: %.*g usec per loop" % (repeat, precision, usec)
|
||||
else:
|
||||
msec = usec / 1000
|
||||
if msec < 1000:
|
||||
print "best of %d: %.*g msec per loop" % (repeat, precision, msec)
|
||||
else:
|
||||
sec = msec / 1000
|
||||
print "best of %d: %.*g sec per loop" % (repeat, precision, sec)
|
||||
return None
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue