Profiling python 2.3

K

Kenneth Johansson

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(statement)
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top