From e69d3fec87c4624e1d88d66efb7232ba5818a516 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 17 Feb 1994 12:36:58 +0000 Subject: Use time.time() instead of time.millitimer() --- Demo/classes/Range.py | 10 +++++----- Demo/rpc/T.py | 6 +++--- Demo/threads/find.py | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Demo/classes/Range.py b/Demo/classes/Range.py index c958f5a..18f626f 100755 --- a/Demo/classes/Range.py +++ b/Demo/classes/Range.py @@ -57,15 +57,15 @@ def test(): print range(10), range(-10, 10), range(0, 10, 2) for i in range(100, -100, -10): print i, print - t1 = time.millitimer() + t1 = time.time() for i in range(1000): pass - t2 = time.millitimer() + t2 = time.time() for i in __builtin__.range(1000): pass - t3 = time.millitimer() - print t2-t1, 'msec (class)' - print t3-t2, 'msec (built-in)' + t3 = time.time() + print t2-t1, 'sec (class)' + print t3-t2, 'sec (built-in)' test() diff --git a/Demo/rpc/T.py b/Demo/rpc/T.py index 475372b..abf3a06 100644 --- a/Demo/rpc/T.py +++ b/Demo/rpc/T.py @@ -6,17 +6,17 @@ import sys, os, time def TSTART(): global t0, t1 u, s, cu, cs = os.times() - t0 = u+cu, s+cs, time.millitimer() + t0 = u+cu, s+cs, time.time() def TSTOP(*label): global t0, t1 u, s, cu, cs = os.times() - t1 = u+cu, s+cs, time.millitimer() + t1 = u+cu, s+cs, time.time() tt = [] for i in range(3): tt.append(t1[i] - t0[i]) [u, s, r] = tt msg = '' for x in label: msg = msg + (x + ' ') - msg = msg + `u` + ' user, ' + `s` + ' sys, ' + `r*0.001` + ' real\n' + msg = msg + `u` + ' user, ' + `s` + ' sys, ' + `r` + ' real\n' sys.stderr.write(msg) diff --git a/Demo/threads/find.py b/Demo/threads/find.py index e97bd99..3bc54fe 100644 --- a/Demo/threads/find.py +++ b/Demo/threads/find.py @@ -110,11 +110,11 @@ def main(): for dir in args: wq.addwork(find, (dir, selector, wq)) - t1 = time.millitimer() + t1 = time.time() wq.run(nworkers) - t2 = time.millitimer() + t2 = time.time() - sys.stderr.write('Total time ' + `t2-t1` + ' msec.\n') + sys.stderr.write('Total time ' + `t2-t1` + ' sec.\n') # The predicate -- defines what files we look for. -- cgit v0.12