Thread analyser
A tool for visualization of concurrent Python programs based on the PyCharm IDE.
Description
A Thread analyser helps to understand the concurrent Python program execution during debug process. Some of it's features include:
- Visualization of events in concurrent programs (programs using module
threading
or moduleasyncio
) - Navigation to the source code for every concurrency event
- A stack trace display
At the moment we recommend to use Python 3 for testing the tool, cause there are a number of bugs related to Python 2.
Installation
A Thread analyser is a part of the PyCharm IDE, so its build instructions concur with PyCharm IDE build instructions.
Usage
A Thread analyser tool is a part of PyCharm IDE. The visualization is available for every Python program during or after debug session in the PyCharm IDE.
Collecting log
In order to build diagram for every debug session, the checkbox "Build diagram for concurrent programs" should be checked in Settings | Build, Execution, Deployment | Python debugger. It is checked by default. If the checkbox is not checked, visualization is not available.
Visualization
The visualization is available in a separate toolwindow named Concurrent activities diagram. The toolwindow contains a table with information about events and threading graph. Each row in the table corresponds to event in a concurrent program. At the moment Thread analyser supports the following types of events:
For module threading
:
- Thread: start, join, stop
- Lock: acquire, release
- Queue: put, get
For module asyncio
:
- Task start
- Lock: acquire, release
- Queue: put, get
Navigation to source code
A click on a row in the table navigates user to the source code of the corresponding concurrency event and shows a stacktrace for event.