You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
possible to sample python cpp extensions ...? #370
Wondering if there's anyway I could get pyinstrument to see into cpp callstacks ... I like pyinstrument and the fact that it can be started up within process.
Even if this feature was difficult to achieve in general -- I'm wondering if there might be a way I could hack together something simpler that would work for my specific codebase. In my codebase, I use nanobind to define an extension module in cpp, and all time spent within is a result of a python function call (python calls into cpp, never the reverse).
I could also conceivably add some code to my python -> cpp callsites to try and make this analysis more feasible ...
Activity
joerick commentedon May 24, 2025
pyinstrument uses
sys.setprofile. As I understand it, I don't think it's possible to profile arbitrary C++ though this interface.I'm on mac, I've had decent luck with profiling with Instruments.app, but I don't know how to set this up for a Python extension.