cProfile, timed call tree
Nico Schlömer
nico.schloemer at gmail.com
Fri May 25 08:09:04 EDT 2018
Hi everyone,
>From what I understand about the Python profilers, the type of information
you get from a stats object is
* How much time was spent in function X,
* what the callers and callees of function X are, and
* and bunch of meta info about function X.
With the program
```
def prime(n):
# compute the n-th prime number, takes longer for larger n
return 2
def a():
return prime(1)
def b():
return prime(4000)
a()
b()
```
I would be able to find that `prime` took a lot of time, but not that it
took more time when called from `b()`. In other words: I cannot construct
the call tree with times from Stats.
Is this correct? If not, how to get a timed call tree from Stats? Perhaps
that's not the right think to work with?
Cheers,
Nico
More information about the Python-list
mailing list