Closed ftrofin closed 4 years ago
pyinstrument is a statistical profiler; computing the number of calls of each function was traded for less profiling overhead. In other words, pyinstrument doesn't record every function call and the time it takes to return, it samples the state of the stack at regular intervals. Using this method, it is not possible to know whether two consecutive measures of the same function are from the same call.
Time spend it children vs self is already reported. pyinstrument reports total time in a function, time spent in [self]
, and time spend in each child. In the example below, the time spent in line_search
children vs itself would be (190 - 116) / 190 ms.
β β ββ 0.190 line_search tike/opt.py:12
β β β ββ 0.116 [self]
β β β ββ 0.074 cost_function tike/ptycho/solvers.py:111
β β β ββ 0.069 _gaussian_cost libtike/cufft/_propagation.py:44
β β β ββ 0.042 array cupy/creation/from_data.py:7
If you don't see [self]
that means the amount of time spent in self was too small to be measured.
@carterbox agree to all of this, thanks for responding!
line number where the call originated (not a big deal, I can infer it by looking up that function in the source code of the parent but most profilers give you that)
This is something I'm considering adding actually, so feel free to prod me about it as a standalone issue if it's important for your use case!
Thank you for writing this profiler it brings a bit of fresh air. I tested it on one of my scripts with the HTMl renderer and while I love the fact that I can collapse/expand the nodes, I really need to see more information (besides total time). At a minimum I'd like to see: