Skip to main content

Python bindings to Intel Instrumentation and Tracing Technology (ITT) API.

Project description

PyPI PyPI - Python Version CI

pyitt

pyitt is a Python binding to Intel Instrumentation and Tracing Technology (ITT) API. It provides a convenient way to mark up the Python code for further performance analysis using performance analyzers from Intel like Intel VTune or others.

pyitt supports following ITT APIs:

  • Collection Control API
  • Counter API
  • Domain API
  • Event API
  • Frame API
  • Id API
  • Processor Trace Control API
  • String Handle API
  • Task API
  • Thread Naming API

Usage

The main goal of the project is to provide the ability to instrument a Python code using ITT API in the Pythonic way. pyitt provides wrappers that simplify markup of Python code.

import pyitt

@pyitt.task
def workload():
  pass

workload()

pyitt.task can be used as a decorator. In this case, the name of a callable object (workload function in this example) will be used as a name of the task and the task will be attributed to a default domain named 'pyitt'. If you want to change the default name and/or other parameters for the task (e.g. task domain), you can pass them as arguments to pyitt.task:

import pyitt

@pyitt.task('My Task', domain='My Task Domain')
def workload():
  pass

workload()

Also, pyitt.task returns the object that can be used as a context manager:

import pyitt

with pyitt.task():
    # some code here...
    pass

If the task name is not specified, the pyitt.task uses call site information (filename and line number) to give the name to the task. A custom name for the task and other task parameters can be specified via arguments for pyitt.task in the same way as for the decorator form.

Installation

pyitt package is available on PyPi and can be installed in the usual way for the supported configurations:

python -m pip install pyitt

Build

The native part of pyitt module is written using C++20 standard, therefore you need a compiler that supports this standard, for example GCC-10 for Linux and Visual Studio 2022 for Windows.

Ubuntu 22.04

  1. Install the compiler and Python utilities to build module:

    sudo apt install gcc g++ python3-pip
    
  2. Clone the repository:

    git clone --recurse-submodules https://github.com/esuldin/pyitt.git
    
  3. Build and install pyitt:

    cd pyitt
    python3 -m pip install .
    

Windows 10/11

  1. Install Python 3.8+ together with pip utility.

  2. Install Visual Studio 2022. Make sure that "Desktop development with C++" workload is selected.

  3. Clone the repository

    git clone --recurse-submodules https://github.com/esuldin/pyitt.git
    
  4. Build and install pyitt

    cd pyitt
    python -m pip install .
    

Compatibility with other Python binding to ITT API

pyitt provides compatibility layers that allow you to use pyitt as a "backend" for other Python bindings to the ITT API.

itt-python

pyitt.compatibility_layers.itt_python fully implements the itt-python public API. It allows you to switch to pyitt without anything else by only replacing the imports. For example, the following import for itt-python:

import itt

should be replaced with:

import pyitt.compatibility_layers.itt_python as itt

For more details, please see itt_python_compatibility_sample.py.

ittapi

pyitt.compatibility_layers.ittapi implements most of ittapi Python binding public API. Technically, the Python binding to ITT API that is included in the ITT API repository is based on the pyitt v1.1.0 code base. But, the implementations have been diverging since then. However, in most cases, it should be possible to use newer versions of pyitt instead of ittapi just by replacing the imports. For example, the import for ittapi:

import ittapi

should be replaced with:

import pyitt.compatibility_layers.ittapi as ittapi

Known Issues and Limitations

  • If pyitt is used in a function which is specified as a target for calls from multiprocessing module and an application is profiled on Linux with Intel VTune Profiler, the following error may occur:

    <...>/data.0/userapicollector-*.trace' (Data file is corrupted)
    

    This issue is caused by libittnotify_collector.so library which is a part of Intel VTune Profiler. Unfortunately, the issue is not resolvable within pyitt itself. However, a potential workaround is to use 'spawn' method for multiprocessing module in the profiled application:

    import multiprocessing
    ...
    if __name__ == '__main__':
        multiprocessing.set_start_method('spawn')
    

    Please see #1 for more technical information.

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyitt-1.7.2.tar.gz (106.5 kB view hashes)

Uploaded Source

Built Distributions

pyitt-1.7.2-pp310-pypy310_pp73-win_amd64.whl (52.7 kB view hashes)

Uploaded PyPy Windows x86-64

pyitt-1.7.2-pp310-pypy310_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (65.7 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyitt-1.7.2-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (65.0 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

pyitt-1.7.2-pp39-pypy39_pp73-win_amd64.whl (52.7 kB view hashes)

Uploaded PyPy Windows x86-64

pyitt-1.7.2-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (65.6 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyitt-1.7.2-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (64.8 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

pyitt-1.7.2-cp313-cp313-win_amd64.whl (52.5 kB view hashes)

Uploaded CPython 3.13 Windows x86-64

pyitt-1.7.2-cp313-cp313-win32.whl (47.5 kB view hashes)

Uploaded CPython 3.13 Windows x86

pyitt-1.7.2-cp313-cp313-musllinux_1_2_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.13 musllinux: musl 1.2+ x86-64

pyitt-1.7.2-cp313-cp313-musllinux_1_2_i686.whl (1.3 MB view hashes)

Uploaded CPython 3.13 musllinux: musl 1.2+ i686

pyitt-1.7.2-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (248.0 kB view hashes)

Uploaded CPython 3.13 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyitt-1.7.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (230.9 kB view hashes)

Uploaded CPython 3.13 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

pyitt-1.7.2-cp312-cp312-win_amd64.whl (52.5 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

pyitt-1.7.2-cp312-cp312-win32.whl (47.5 kB view hashes)

Uploaded CPython 3.12 Windows x86

pyitt-1.7.2-cp312-cp312-musllinux_1_2_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.2+ x86-64

pyitt-1.7.2-cp312-cp312-musllinux_1_2_i686.whl (1.3 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.2+ i686

pyitt-1.7.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (243.8 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyitt-1.7.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (226.0 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

pyitt-1.7.2-cp311-cp311-win_amd64.whl (52.6 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

pyitt-1.7.2-cp311-cp311-win32.whl (47.5 kB view hashes)

Uploaded CPython 3.11 Windows x86

pyitt-1.7.2-cp311-cp311-musllinux_1_2_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.2+ x86-64

pyitt-1.7.2-cp311-cp311-musllinux_1_2_i686.whl (1.3 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.2+ i686

pyitt-1.7.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (243.2 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyitt-1.7.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (226.2 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

pyitt-1.7.2-cp310-cp310-win_amd64.whl (52.6 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

pyitt-1.7.2-cp310-cp310-win32.whl (47.5 kB view hashes)

Uploaded CPython 3.10 Windows x86

pyitt-1.7.2-cp310-cp310-musllinux_1_2_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.2+ x86-64

pyitt-1.7.2-cp310-cp310-musllinux_1_2_i686.whl (1.3 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.2+ i686

pyitt-1.7.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (241.5 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyitt-1.7.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (225.5 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

pyitt-1.7.2-cp39-cp39-win_amd64.whl (52.7 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

pyitt-1.7.2-cp39-cp39-win32.whl (47.5 kB view hashes)

Uploaded CPython 3.9 Windows x86

pyitt-1.7.2-cp39-cp39-musllinux_1_2_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.2+ x86-64

pyitt-1.7.2-cp39-cp39-musllinux_1_2_i686.whl (1.3 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.2+ i686

pyitt-1.7.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (239.3 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyitt-1.7.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (223.3 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

pyitt-1.7.2-cp38-cp38-win_amd64.whl (52.7 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

pyitt-1.7.2-cp38-cp38-win32.whl (47.5 kB view hashes)

Uploaded CPython 3.8 Windows x86

pyitt-1.7.2-cp38-cp38-musllinux_1_2_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.2+ x86-64

pyitt-1.7.2-cp38-cp38-musllinux_1_2_i686.whl (1.3 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.2+ i686

pyitt-1.7.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (242.4 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyitt-1.7.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (225.9 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page