performance measurement questions

Discussion in 'Python' started by Eric S. Johansson, Jul 6, 2004.

  1. 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?
     
    Eric S. Johansson, Jul 6, 2004
    #1
    1. Advertising

  2. Eric S. Johansson

    Roy Smith Guest

    In article <>,
    "Eric S. Johansson" <> 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.
     
    Roy Smith, Jul 6, 2004
    #2
    1. Advertising

  3. Roy Smith wrote:
    > In article <>,
    > "Eric S. Johansson" <> 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
     
    Eric S. Johansson, Jul 6, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?ISO-8859-1?Q?J=F6rg_Marti?=

    JPS 1.4: unit of measurement in the printDialog()

    =?ISO-8859-1?Q?J=F6rg_Marti?=, Aug 12, 2003, in forum: Java
    Replies:
    0
    Views:
    360
    =?ISO-8859-1?Q?J=F6rg_Marti?=
    Aug 12, 2003
  2. Alex Vinokur
    Replies:
    3
    Views:
    1,148
    Siemel Naran
    Jul 22, 2004
  3. Alex Vinokur
    Replies:
    0
    Views:
    529
    Alex Vinokur
    Aug 29, 2004
  4. Eric S. Johansson

    actual time performance measurement

    Eric S. Johansson, Jun 29, 2004, in forum: Python
    Replies:
    0
    Views:
    379
    Eric S. Johansson
    Jun 29, 2004
  5. Andreas Göbel
    Replies:
    3
    Views:
    300
    Phlip
    Mar 30, 2006
Loading...

Share This Page