Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > performance measurement questions

Reply
Thread Tools

performance measurement questions

 
 
Eric S. Johansson
Guest
Posts: n/a
 
      07-06-2004
I've been playing with the profiler and have been rather successful in
making my code run faster. So for my best success has been cutting a
three second CPU time run down to about 0.45 seconds.

Unfortunately, the same application seems to take about 8 to 12 seconds
real-time. I know that some of that time is lost to file IO and
external sub processes but I don't know how much.

Is there any way to change the profiler to measure elapsed time and not
CPU time?


 
Reply With Quote
 
 
 
 
Roy Smith
Guest
Posts: n/a
 
      07-06-2004
In article <(E-Mail Removed)>,
"Eric S. Johansson" <(E-Mail Removed)> wrote:

> I've been playing with the profiler and have been rather successful in
> making my code run faster. So for my best success has been cutting a
> three second CPU time run down to about 0.45 seconds.
>
> Unfortunately, the same application seems to take about 8 to 12 seconds
> real-time. I know that some of that time is lost to file IO and
> external sub processes but I don't know how much.
>
> Is there any way to change the profiler to measure elapsed time and not
> CPU time?


I don't know about the profiler, but there's a couple of things you
could do to try and figure out what's going one (all of these assume a
unix-like environment):

First, use the "time" command to run your program, like this:

> Roy-Smiths-Computer:unit$ time ./TargetUnit.py
> ........
> ----------------------------------------------------------------------
> Ran 8 tests in 1.064s
>
> OK
>
> real 0m1.340s
> user 0m0.960s
> sys 0m0.100s


That should give you a rough idea what's going on.

If you have some ideas where the time might be spent internally, you can
use the os.times() function to gather time snapshots around areas you
suspect of being slow.
 
Reply With Quote
 
 
 
 
Eric S. Johansson
Guest
Posts: n/a
 
      07-06-2004
Roy Smith wrote:
> In article <(E-Mail Removed)>,
> "Eric S. Johansson" <(E-Mail Removed)> wrote:
>
>
>>I've been playing with the profiler and have been rather successful in
>>making my code run faster. So for my best success has been cutting a
>>three second CPU time run down to about 0.45 seconds.
>>
>>Unfortunately, the same application seems to take about 8 to 12 seconds
>>real-time. I know that some of that time is lost to file IO and
>>external sub processes but I don't know how much.
>>
>>Is there any way to change the profiler to measure elapsed time and not
>>CPU time?

>
>
> I don't know about the profiler, but there's a couple of things you
> could do to try and figure out what's going one (all of these assume a
> unix-like environment):
>
> First, use the "time" command to run your program, like this:


unfortunately, the programs in question are CGI's and servers. I need
something networks inside the program.

> If you have some ideas where the time might be spent internally, you can
> use the os.times() function to gather time snapshots around areas you
> suspect of being slow.


when it comes to program performance measurement, guessing usually gives
you a wrong answer since my request for profiling that measures elapsed
time.

unfortunately, I may need to do as you suggest in place time functions
throughout the code.

---eric

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Performance measurement of a single method Andreas Göbel C++ 3 03-30-2006 02:35 PM
Measurement preferences Paul Blarmy Firefox 3 06-01-2005 03:01 PM
Sorting : Comparative performance measurement Alex Vinokur C++ 0 08-29-2004 04:54 PM
Performance measurement and optimization levels Alex Vinokur C++ 3 07-22-2004 07:49 AM
actual time performance measurement Eric S. Johansson Python 0 06-29-2004 05:55 PM



Advertisments