FAQ
How to place the timer in python code.

I want calculate the python script execution time.

ex : Start Timer
: End Timer

Execution Time : End Timer - Start Timer.

How can we write the python code for this.

Help would be appreciable.

Thanks in Advance.

Vamsi

Search Discussions

  • Avell Diroll at Sep 18, 2009 at 10:11 am

    Vamsikrishna wrote:
    How to place the timer in python code.
    timeit ...

    it's in the standard library:

    http://docs.python.org/library/timeit.html

    Cheers,

    Ju
    --
    Whomever controls the press, owns history
    -- Johann Gutenberg
  • Dave Angel at Sep 18, 2009 at 12:52 pm

    Vamsikrishna wrote:
    How to place the timer in python code.

    I want calculate the python script execution time.

    ex : Start Timer
    : End Timer

    Execution Time : End Timer - Start Timer.

    How can we write the python code for this.

    Help would be appreciable.

    Thanks in Advance.

    Vamsi
    import time
    start = time.time()
    ...... DO SOME STUFF

    print "Elapsed time", time.time() - start

    Note that the time resolution on some OS's is better than others. So if
    you're on a system that only gives one-second resolution, you may want
    to use a different function.

    DaveA

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedSep 18, '09 at 9:51a
activeSep 18, '09 at 12:52p
posts3
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase