Place the timer in Python script
davea at ieee.org
Fri Sep 18 14:52:14 CEST 2009
> How to place the timer in python code.
> I want calculate the python script execution time.
> ex : Start Timer
> : End Timer
> Execution Time : End Timer - Start Timer.
> How can we write the python code for this.
> Help would be appreciable.
> Thanks in Advance.
start = time.time()
...... DO SOME STUFF
print "Elapsed time", time.time() - start
Note that the time resolution on some OS's is better than others. So if
you're on a system that only gives one-second resolution, you may want
to use a different function.
More information about the Python-list