removing data from the profiler Stats object

Discussion in 'Python' started by Stephen C Phillips, Jan 14, 2004.

  1. Hi,
    I have just started using the Python profiler and cannot get
    the output I want. Once I have profiled a piece of code and saved the
    data to a file, I can load it in using the pstats module. I have found
    that 96% of my program's time is spent in three object methods (and their
    callees) but want to know what the other 4% is.

    I can do this:

    p = pstats.Stats('profile.data')
    p.print_callees('expensive_method1')
    p.print_callees('expensive_method2')
    p.print_callees('expensive_method3')

    Which makes me think that the data must be held in a tree of some sort,
    but what I want is to prune those branches from the tree and see the rest
    of the data:

    p.print_stats(without expensive_method[123])

    I suppose I could roughly get this data by changing the three expensive
    methods to immediately return some dummy data, but thought it ought to be
    possible to interrogate the Stats object to get the answer.

    The other 4% may also include calls to the same functions as in the 96% so
    it is not just a matter of looking at the data for particular functions.
    I know it seems silly to be chasing after 4% of the profile but it is
    important in this case.

    Thanks.

    Stephen Phillips.
    Stephen C Phillips, Jan 14, 2004
    #1
    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. Utter Newbie
    Replies:
    0
    Views:
    464
    Utter Newbie
    Jul 28, 2003
  2. Dan
    Replies:
    0
    Views:
    337
  3. Chris  Chiasson
    Replies:
    6
    Views:
    612
    Richard Tobin
    Nov 14, 2006
  4. potatosoftware
    Replies:
    0
    Views:
    659
    potatosoftware
    Nov 4, 2009
  5. Christopher Barrington-Leigh

    scipy / stats : quantiles using sample weights from survey data

    Christopher Barrington-Leigh, Aug 4, 2010, in forum: Python
    Replies:
    1
    Views:
    394
Loading...

Share This Page