removing data from the profiler Stats object

S

Stephen C Phillips

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.
 

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,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top