Python Tools for Visual Studio also supports profiling your Python program (this feature is only available for CPython based interpreters and requires Visual Studio 2010 Ultimate. You must also be running SP1 of VS 2010 or later). To start profiling
you can go to the Analyze menu and and select Launch Python Profiling. You can then use the dialog to configure how you’d like to setup profiling:
When you click OK the profiler will run and then open the resulting performance report. You can then drill into which functions are consuming the most time.
Note: Please see the Cluster/MPI section for Profiling code on a cluster.
As previously mentioned profiling support is currently limited to CPython based interpreters due to the instrumentation that is performed. For profiling against IronPython you have a couple of options:
To use the normal .NET profiler you can just launch ipy.exe directly as your target application with the appropriate arguments to launch your startup script. You'll also want to provide -X:Debug on the command line to force
all of your Python code to be debuggable and profilable. This will result in a performance report which includes time spent both in the IronPython runtime as well as your code. Your code will be identified using mangled names.
IronPython also has some of its own profiling support built-in but there’s no good visualizer for it. More information on that’s available here: