A new sampling profiler tool for Python developers, Py-Spy, gathers statistics about running Python programs without needing to instrument the code or even restart a running application.
Written by developer Ben Frederickson, Py-Spy can be installed via Python’s
pip installer, and it runs on both Linux and Windows. This makes it uncomplicated to set up and useful in most any environment where Python is running.
[ What is Python? Everything you need to know. • Tutorial: How to get started with Python. • 6 essential libraries for every Python developer. • Why you should use Python for machine learning. | Keep up with hot topics in programming with InfoWorld’s App Dev Report newsletter. ]
Most profiling systems for Python, says Frederickson in his project’s notes, require changes to the source code to instrument the application. Aside from the possible hassles of modifying source, this also means the profiling code has to run in the same process as the app itself. “This means it’s not generally safe to use these profilers for debugging issues in production services since they will usually have a noticeable impact on performance,” he writes.
To read this article in full, please click here