skip to content | skip to sidebar

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.

using it

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 VTResume() and VTPause().

import pyvtuneapi
# ...
pyvtuneapi.VTResume()
# code of interest goes here
pyvtuneapi.VTPause()

subversion repository

download

building and installing

  1. Make sure you have VTune Performance Analyzer installed ;)
  2. Unpack the source code into a temporary directory, or grab it from the repository
  3. Enter setup.py built_ext on 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.py is pretty dumb in locating VtuneApi.h and 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"
  4. Finally, install by executing setup.py install from the command line.