Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Thread-aware profiler

Project description

A multi-thread aware profiler package, with an API similar to that of the standard cProfile module. Profiling data generated by mtprof is in the same format as that generated by cProfile and can therefore be analyzed using the same tools (such as pstats, snakeviz, etc.).


Python 3 is required, and only POSIX systems (Linux, etc.) are currently supported.


This is a pure Python package, so pip install mtprof should generally work everywhere.

Command-line interface

python -m mtprof provides an interface similar to python -m cProfile and allows you to profile scripts, modules or entire applications.

Python API

The mtprof.Profile class has an API similar to cProfile.Profile.


Due to the way Python profiling works, mtprof is only able to exploit profiling stats from threads whose lifetime is a subset of the profiler’s lifetime. A thread started before profiling was started, or ended after profiling was stopped, cannot have its statistics collected.

Due to this limitation, it is probably easier to use the command-line interface, which is similar to that of cProfile: just run python -m mtprof --help to get a view of the available options.

Only threads created using the standard threading.Thread interface are recognized. For most use cases this should not be an issue.


This package is experimental.

Project details

Download files

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

Files for mtprof, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size mtprof-0.0.3-py2.py3-none-any.whl (8.4 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size mtprof-0.0.3.tar.gz (6.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page