Profiling with hotshot and wall clock time

G

Geert Jansen

Hi!

I'm trying to profile an application that I believe is blocking on I/O
for a significant amount of time. In trying to dig down where this
happens, I profiled the application with hotshot. The results are not
really usable however as it seems to display the amount of CPU time
which for my application is much lower than the total run time.

Is possible to use hotshot with wall clock time, i.e. is it possible to
have the code fragment below show one second as opposed to zero? The old
profiler seems to have functionality choosing a timer function but it
crashed on my code.

<cut>
import os
import time
import hotshot
import hotshot.stats
import tempfile

def profile(call, *args):
"""Profile function `call', invoked with `args'."""
fd, fprof = tempfile.mkstemp()
os.close(fd)
profiler = hotshot.Profile(fprof)
profiler.runcall(call, *args)
profiler.close()
stats = hotshot.stats.load(fprof)
stats.strip_dirs().sort_stats('time').print_stats()
os.remove(fprof)

profile(time.sleep, 1)
</cut>

Regards,
Geert Jansen
 
D

Dieter Maurer

Geert Jansen said:
...
Is possible to use hotshot with wall clock time, i.e. is it possible
to have the code fragment below show one second as opposed to zero?
The old profiler seems to have functionality choosing a timer function
but it crashed on my code.

I do not know whether it is possible with "hotshop" but it is
with "profile". Depending on how large the waiting time it,
"profile" might be adequate to analyse the problem.


Dieter
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top