pyvtuneapi: VTune API for Python
pyvtuneapi is a very simple extension that binds the VTune API to Python. If you have Intel(R) VTune(TM) Performance Analyzer, and you’re using it to profile a Python driven application, you can use
pyvtuneapi to pause and resume the analyzer.
There’s not much to it, really. Configure your analyzer activity so that it starts paused by checking “Start with data collection paused” in the activity configuration window. Then import
pyvtuneapi in your application and surround the code of interest by calls to
import pyvtuneapi # ... pyvtuneapi.VTResume() # code of interest goes here pyvtuneapi.VTPause()
building and installing
- Make sure you have VTune Performance Analyzer installed ;)
- Unpack the source code into a temporary directory, or grab it from the repository
setup.py built_exton the command line.
- If you’re doing this on a Windows box and things freak out because you don’t have a C++ compiler installed or properly configured, you might be interested in my five little steps how to use the Visual C++ 2005 Express compiler (which is availabe for free!). But that’s probably not gonna be necessary, since you probably will already have installed a C++ compiler if your interested in VTune ;)
setup.pyis pretty dumb in locating
VtuneApi.lib, therefore you’ll probably need to specify their locations yourself like so:
setup.py build_ext --include-dirs="C:\Program Files\Intel\VTune\Analyzer\Include" --library-dirs="C:\Program Files\Intel\VTune\Analyzer\Lib"
- Finally, install by executing
setup.py installfrom the command line.