joerick/pyinstrument

Proposal: Optionally Skip Frames in Output

mlucool opened this issue · 5 comments

Hi,

__tracebackhide__ is used in pytest and IPython to tell tooling that a frame should be hidden from the user when looking at stacktraces. It would be helpful if users can optionally reuse this marking to tell pyinstrument not to show it in output. This is generally helpful as it enables you focus on user code you can control instead of library code that you cannot.

Example:

0.100 A
    |- 0.090 B
         |- 0.080 C
               | - 0.070 D

If B and C are hidden, we'd show:

0.100 A
   |- <skipped 2 frames>
       |- 0.070 D

Interesting. So if this local is set tooling should ignore these frames? It will require some refactorings and might have a perf impact but looks like a good idea!

Exactly!

Is this something you want to tackle or would you prefer someone makes a PR with this feature for you to review?

Happy to review a PR on this, if you want to have a crack at it! Though it might require modifications to the C extension, i don't know if you'd be comfortable with that?

@joerick I took this one on. See #211. Feedback would be much appreciated