Python Dynamic Profiling

E

esgameserver

Hi,

Sorry for re-posting but I want to clarify my question again here.

So, we have a multithreaded server application and I want to see the
profile of our code means which function is executed how many times
and time spent in that function dynamically. With dynamic, I mean
without stopping the profiled thread.

Is there any way to do that, other than hacking my own code with hooks
and calculating the info above by hand?

P.S:cProfile and Profile modules are very good indeed, but as far as I
understand you need to stop the profiler and the associated thread to
see the profile results. That is unacceptable for my situation.

Thanks,
 
R

Robert Kern

Hi,

Sorry for re-posting but I want to clarify my question again here.

So, we have a multithreaded server application and I want to see the
profile of our code means which function is executed how many times
and time spent in that function dynamically. With dynamic, I mean
without stopping the profiled thread.

Is there any way to do that, other than hacking my own code with hooks
and calculating the info above by hand?

P.S:cProfile and Profile modules are very good indeed, but as far as I
understand you need to stop the profiler and the associated thread to
see the profile results. That is unacceptable for my situation.

Don't use the run*() methods. Instead, use enable() and disable(). This means
that the profiler isn't the thing calling your code. You can stop it and collect
the profile information without halting your code.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top