Ahmed AL-Masri wrote:
Hi, I would calculate the running time of my simulation code.
any one know how to do that?

example

def demo():
    ########### the starting point of time should be 0
     f.simulate(data)
    ########### the end of the class so need to find the time in Sec.?
    ########### print time in sec.
if __name__ == '__main__':
    demo()

look forward to seeing the answer,

Thanks a lot,
A. Naufal

If you're really looking to measure performance, you should use the timeit module. But for simply deciding how much time has elapsed between two points in your code, you can use the time.time() function.

import time

start = time.time()
...  do some work
end = time.time()-start


DaveA
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to