[Tutor] Evaluating program running time?

Lie Ryan lie.1296 at gmail.com
Sat Apr 9 07:32:50 CEST 2011


On 04/09/11 04:29, 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.
> 

import cProfile
...
def main():
    ...

cProfile.run('main()')



More information about the Tutor mailing list