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 windows
> also there is a library timeit().
> but it doesn't give the accurate details.
> What I want is :
> 1 . Execution time taken by the program or the CPU time
> 2 . Users Time
> 3 . Time taken by Function
> 4 . Memory required by the program
> 
> Thank you
> 


Most of what you want to measure is not Python specific but handled by your 
operating
system shell. For instance, to measure #1, #2, #4 and a bunch of other metrics, 
you can
do on Linux:

$ /usr/bin/time -v  your-program

and you will get a whole lot of info about the execution of your-program.

If you want to measure Python specific stuff such as the time taken by each 
function,
you can use the Python profiler to do that:
https://docs.python.org/3.4/library/profile.html



Irmen

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to