Profiling python 2.3

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kenneth Johansson

    #1

    Profiling python 2.3

    I wonder what would be a good way to profile a python program where the
    main thread starts two worker threads that do all the work.

    I get no infomation at all from the threads.

    I tried to use profile.run as the first thing in the new thread and the
    thread starts and works fine but when it exits I get this error

    File "/usr/lib/python2.3/profile.py", line 71, in run
    prof = prof.run(statem ent)
    File "/usr/lib/python2.3/profile.py", line 403, in run
    return self.runctx(cmd , dict, dict)
    File "/usr/lib/python2.3/profile.py", line 409, in runctx
    exec cmd in globals, locals
    TypeError: exec: arg 1 must be a string, file, or code object



    The main problem I have is that when I add a small function to a program
    the resulting code takes longer than it should. The program takes
    about 80% normally and end up taking more than 100%. I did a small test
    of the new funtions and when I run that alone it only takes 20%-25% so
    the result sould not take more than 50% and now I need to know where the
    time is spent.
  • Stephen Kellett

    #2
    Re: Profiling python 2.3

    In message <ctbora$84d$1@n ewstree.wise.ed t.ericsson.se>, Kenneth
    Johansson <ken@switchboar d.ericsson.se> writes[color=blue]
    >I wonder what would be a good way to profile a python program where the
    >main thread starts two worker threads that do all the work.
    >
    >I get no infomation at all from the threads.[/color]

    Python Performance Validator (beta)



    Stephen
    --
    Stephen Kellett
    Object Media Limited http://www.objmedia.demon.co.uk
    RSI Information: http://www.objmedia.demon.co.uk/rsi.html

    Comment

    • Kenneth Johansson

      #3
      Re: Profiling python 2.3

      On Fri, 28 Jan 2005 10:02:33 +0000, Stephen Kellett wrote:
      [color=blue]
      > In message <ctbora$84d$1@n ewstree.wise.ed t.ericsson.se>, Kenneth
      > Johansson <ken@switchboar d.ericsson.se> writes[color=green]
      >>I wonder what would be a good way to profile a python program where the
      >>main thread starts two worker threads that do all the work.
      >>
      >>I get no infomation at all from the threads.[/color]
      >
      > Python Performance Validator (beta)
      >
      > http://www.softwareverify.com/python...tor/index.html
      >
      > Stephen[/color]

      I develop on linux.

      Nice to see I do not have to recompile and relink to use the tool that's a
      real problem with other python stuff ;)


      Comment

      Working...