469,610 Members | 1,554 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,610 developers. It's quick & easy.

performance measurement questions

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?
Jul 18 '05 #1
2 1792
In article <ma************************************@python.org >,
"Eric S. Johansson" <es*@harvee.org> 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.
Jul 18 '05 #2
Roy Smith wrote:
In article <ma************************************@python.org >,
"Eric S. Johansson" <es*@harvee.org> 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

Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Eric S. Johansson | last post: by
reply views Thread by Alex Vinokur | last post: by
4 posts views Thread by zzfreddybb | last post: by
8 posts views Thread by Sebastian Werner | last post: by
4 posts views Thread by Martin | last post: by
2 posts views Thread by Jeff S | last post: by
12 posts views Thread by webdeveloper | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.