Profiling with hotshot and wall clock time

Discussion in 'Python' started by Geert Jansen, Nov 24, 2005.

  1. Geert Jansen

    Geert Jansen Guest

    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
    Geert Jansen, Nov 24, 2005
    #1
    1. Advertising

  2. Geert Jansen <> writes on Thu, 24 Nov 2005 21:33:03 +0100:
    > ...
    > 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
    Dieter Maurer, Nov 26, 2005
    #2
    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. Irmen de Jong
    Replies:
    0
    Views:
    258
    Irmen de Jong
    Oct 30, 2004
  2. Irmen de Jong
    Replies:
    2
    Views:
    342
    Irmen de Jong
    Nov 3, 2004
  3. Peter Hansen
    Replies:
    13
    Views:
    676
    Peter Hansen
    Jul 7, 2005
  4. Coates, Steve (ACHE)

    RE: Determining actual elapsed (wall-clock) time

    Coates, Steve (ACHE), Jul 4, 2005, in forum: Python
    Replies:
    2
    Views:
    379
    Roy Smith
    Jul 4, 2005
  5. Replies:
    5
    Views:
    1,537
    Ben Bacarisse
    Nov 19, 2006
Loading...

Share This Page