Place the timer in Python script

V

Vamsikrishna

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.

Vamsi
 
D

Dave Angel

Vamsikrishna said:
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.

Vamsi
import time
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.

DaveA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top