[Tutor] Evaluating program running time?
bob gailer
bgailer at gmail.com
Fri Apr 8 21:49:00 CEST 2011
On 4/8/2011 2:29 PM, Cory Teshera-Sterne wrote:
> Hi all,
>
> I have a small(ish) Python program, and I need to be able to log the
> running time. This isn't something I've ever really encountered, and
> I've been led to believe it can be a little hairy. Are there any
> Python-specific approaches to this? I found the "timeit" module, but
> that doesn't seem to be quite what I'm looking for.
I like to use the time module
import time
start = time.time()
rest of program
print time.time() - start
I believe that gives best precisioni on *nix
On Windows use time.clock() )instead.
--
Bob Gailer
919-636-4239
Chapel Hill NC
More information about the Tutor
mailing list