3 Respostas
+ 3
import time
start = time.time()
//commands
//commands
end = time.time()
print end - start
+ 2
timeit is designed to smooth out execution time differences over many iterations:
from timeit import timeit
print( timeit('costly_func()') ) # default 100000 iterations
The Windows high-resolution timer appears to be unavailable here, so accuracy is about 15.8ms
# Some optional parameters:
# setup='from mymodule import costly_func', number=howManyTimes
0
it works
thanks for your help