Re: Execution Time and Memory taken by the program

2014-07-23 Thread Irmen de Jong
On 23-7-2014 17:50, Orochi wrote: > I want a timer to calculate the execution time of the program > actually I am trying to solve problems on codechef.com and want to find out > the time and memory taken by the program to execute. > > I know we can import time.time() in unix and time.clock() in

Re: execution time

2008-12-14 Thread Steven D'Aprano
On Sun, 14 Dec 2008 18:35:24 +0100, Andreas Kostyrka wrote: > On Sun, Dec 14, 2008 at 05:03:38PM +0100, David Hláčik wrote: >> Hi guys, >> >> #! /usr/bin/python >> >> import random >> import bucket2 >> >> data = [ random.randint(1,25) for i in range(5)] print "random data : >> %s" % data >> pri

Re: execution time

2008-12-14 Thread Andreas Kostyrka
On Sun, Dec 14, 2008 at 05:03:38PM +0100, David Hláčik wrote: > Hi guys, > > #! /usr/bin/python > > import random > import bucket2 > > data = [ random.randint(1,25) for i in range(5)] > print "random data : %s" % data > print "result: %s" %bucket2.sort(data) > > How to write a test script which

Re: execution time

2008-12-14 Thread Bruno Desthuilliers
David Hláčik a écrit : Hi guys, #! /usr/bin/python import random import bucket2 data = [ random.randint(1,25) for i in range(5)] print "random data : %s" % data print "result: %s" %bucket2.sort(data) How to write a test script which will outputs execution time for bucket2.sort(data) ? http:

Re: Execution time of lines within a function

2006-12-07 Thread Ed Leafe
On Dec 4, 2006, at 11:36 PM, Paul McGuire wrote: > The PythonDecoratorLibrary page on the Python wiki has a link to a > @profile > decorator, that I have used to profile the contents of targeted > functions > (only just now, I don't seem to be able to get to the wiki to get > the exact > lin

Re: Execution time of lines within a function

2006-12-04 Thread Paul McGuire
"monkeyboy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > I have a function that hotshot says is very slow. I can get the > aggregate execution time, but is there a way to get the execution time > of each line so I can find the bottleneck? > > Thank you > The PythonDeco

Re: Execution time of lines within a function

2006-12-04 Thread monkeyboy
The output was from print_callees(). It appears as though print_stats() and print_callees() return the same data, just in a different orangization. There is supposed to be a "lineevents=1" option in hotshot.Profile, for line timings, but it doesn't seem to work in Python 2.4. Thanks for your help

Re: Execution time of lines within a function

2006-12-04 Thread Neil Cerutti
On 2006-12-04, monkeyboy <[EMAIL PROTECTED]> wrote: > Thanks Neil, > > I looked at that, but maybe I don't understand the output. I > was hoping to see the cummulative time for the function and > then the time associated with each statement (line) within the > function. > > Any suggestions? I don'

Re: Execution time of lines within a function

2006-12-04 Thread monkeyboy
Thanks Neil, I looked at that, but maybe I don't understand the output. I was hoping to see the cummulative time for the function and then the time associated with each statement (line) within the function. In the hotshot output below, I can see the function being called 100 times, which is corre

Re: Execution time of lines within a function

2006-12-04 Thread Neil Cerutti
On 2006-12-04, monkeyboy <[EMAIL PROTECTED]> wrote: > I have a function that hotshot says is very slow. I can get the > aggregate execution time, but is there a way to get the > execution time of each line so I can find the bottleneck? Try 'print_callees' on the stats object for your bottleneck. T