Use time.time() instead of time.millitimer()
This commit is contained in:
parent
d9193c67d6
commit
e69d3fec87
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue