[BangPypers] Place the timer in Python script
vsapre80 at gmail.com
Fri Sep 18 12:32:11 CEST 2009
On Fri, Sep 18, 2009 at 3:43 PM, steve <steve at lonetwin.net> wrote:
> On 09/18/2009 03:33 PM, Vamsi 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.
> Specifically, the timeit module
> btw, dunno if you've heard about this really neat web application. It is a
> simple text box with a couple of buttons that answers questions such as
> these. I forgot it's name. It's something like golgol or some such.
> - steve
> random non tech spiel: http://lonetwin.blogspot.com/
> tech randomness: http://lonehacks.blogspot.com/
> what i'm stumbling into: http://lonetwin.stumbleupon.com/
> BangPypers mailing list
> BangPypers at python.org
Here's what I usually do on windows:
from time import clock, strftime, gmtime
start = clock()
... do you work here...
end = clock()
elapsed = end - start
print "Time Taken to finish: %s" % (strftime("%Hhrs: %Mmins: %ssecs",
If you wish to record in miliseconds, you'll have to do some math on the
Thanks and best regards,
"So say...Day by day, in every way, I am getting better, better and better
"A Strong and Positive attitude creates more miracles than anything else.
Because...Life is 10% how you make it, and 90% how you take it"
"Diamond is another piece of coal that did well under pressure”
"Happiness keeps u Sweet, Trials keep u Strong,
Sorrow keeps u Human, Failure Keeps u Humble,
Success keeps u Glowing, But only God Keeps u Going.....Keep Going....."
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the BangPypers