django-silk
django-silk copied to clipboard
Use PyFlame (Ptracing Profiler For Python)
This is a feature request.
It would be nice to integrate pyflame (Ptracing Profiler For Python) into django-silk.
https://github.com/uber/pyflame A Ptracing Profiler For Python
Pyflame is a high performance profiling tool that generates flame graphs for Python. Pyflame is implemented in C++, and uses the Linux ptrace(2) system call to collect profiling information. It can take snapshots of the Python call stack without explicit instrumentation, meaning you can profile a program without modifying its source code.
I think this is a bit of a non starter since pyflame is linux only and you have to invoke the code you want to profile via the pyflame executable which would make this hard to integrate into silk. On top of that the generation of the graphs is dependent on perl and flamegraph.pl (probably not an issue on most linux installations, but if windows support was there this would be an additional packaging headache)
Is there something you are missing from the current profiling in silk? Personally I would also prefer a flame graph visualisation to the dot graph, but the latter was much easier to implement using existing tools. Of course with a bit tweaking this graph can also be shown as a flame graph.
Py-Spy is basically same thing but supports Windows and OSX
https://github.com/benfred/py-spy
@dralley thank you for this hint. Py-spy looks good.
@dralley thanks for the info! Looks very interesting. It's a shame that flamegraph.pl is still required. I think the solution would boil down to just documenting that you need perl to be installed if you want to view flamegraphs, again for linux this won't be a problem, but for windows it's an additional step. There already seems to be a bit of confusion about how to get profiling working!
Perhaps another approach is to look at something like https://github.com/spiermar/d3-flame-graph for generating the flame graphs in the front end, which means all you need to do is pip install django-silk
and it should work out of the box.