Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75092 > unrolled thread

Execution Time and Memory taken by the program

Started byOrochi <kartikjagdale11@gmail.com>
First post2014-07-23 08:50 -0700
Last post2014-07-23 19:40 +0200
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Execution Time and Memory taken by the program Orochi <kartikjagdale11@gmail.com> - 2014-07-23 08:50 -0700
    Re: Execution Time and Memory taken by the program Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2014-07-23 19:40 +0200

#75092 — Execution Time and Memory taken by the program

FromOrochi <kartikjagdale11@gmail.com>
Date2014-07-23 08:50 -0700
SubjectExecution Time and Memory taken by the program
Message-ID<253e08b9-e928-424d-a5de-2a596d1c8f5b@googlegroups.com>
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

[toc] | [next] | [standalone]


#75095

FromIrmen de Jong <irmen.NOSPAM@xs4all.nl>
Date2014-07-23 19:40 +0200
Message-ID<53cff383$0$2901$e4fe514c@news.xs4all.nl>
In reply to#75092
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web