I just use ipython's functions (that are themselves just calls to the time module functions) for timing my functions...
Enter: %timeit? or %time At the Ipython command prompt to get started. Ben R. On Jul 29, 2010, at 7:43 AM, D'Arcy J.M. Cain wrote: > On Thu, 29 Jul 2010 08:45:23 -0400 > Joe Riopel <goo...@gmail.com> wrote: >> On Thu, Jul 29, 2010 at 8:34 AM, Mahmood Naderan <nt_mahm...@yahoo.com> >> wrote: >>> the output should be 7600 (s) for example. What is the best and easiest way >>> to do that? >> >> Take a look at time.clock() > > I don't know if that's what he wants. The clock() method returns > processor time, not wall time. > > Python 2.6.5 (r265:79063, Jul 8 2010, 16:01:18) > [GCC 4.1.3 20080704 prerelease (NetBSD nb2 20081120)] on netbsd5 > Type "help", "copyright", "credits" or "license" for more information. >>>> from time import time, clock, sleep >>>> t = time() >>>> print time() - t, clock() > 0.000596046447754 0.03 >>>> sleep(3) >>>> print time() - t, clock() > 3.03474903107 0.03 >>>> x = open("BIGFILE").read() >>>> print time() - t, clock() > 10.2008538246 1.42 > > -- > D'Arcy J.M. Cain <da...@druid.net> | Democracy is three wolves > http://www.druid.net/darcy/ | and a sheep voting on > +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner. > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list