[Tutor] Time

Christian Witts cwitts at compuscan.co.za
Tue Jun 22 13:32:19 CEST 2010


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
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>   

You can take a look at the timeit module [1] and some nice examples [2].

[1] http://docs.python.org/library/timeit.html
[2] http://www.doughellmann.com/PyMOTW/timeit/

-- 
Kind Regards,
Christian Witts




More information about the Tutor mailing list