The top-like text-based user interface for Austin
Project description
A Top-like Interface for Austin
Synopsis • Installation • Usage • Compatibility • Contribute
Synopsis
The Python TUI is a top-like text-based user interface for Austin, the frame stack sampler for CPython. Originally planned as a sample application to showcase Austin uses, it's been promoted to a full-fledged project thanks to great popularity.
The header shows you the information of the application that is being profiled, like its PID, the command line used to invoke it, as well as a plot of the amount of CPU and memory that is being used by it, in a system-monitor style.
To know more about how the TUI itself was made, have a read through The Austin TUI Way to Resourceful Text-based User Interfaces.
Installation
Austin TUI can be installed directly from PyPI with
pip install austin-tui --upgrade
NOTE In order for the TUI to work, the Austin 2 binary needs to be on the
PATH
environment variable. Have a look at Austin installation instructions to see how you can easily install Austin on your platform.
Usage
Once Austin and Austin TUI are installed, you can start using them
straight-away. If you want to launch and profile a Python script, say
myscript.py
, you can do
austin-tui python3 myscript.py
or, if myscript.py
is an executable script,
austin-tui myscript.py
Like Austin, the TUI can also attach to a running Python application. To analyse the frame stacks of all the processes of a running WSGI server, for example, get hold of the PID of the parent process and do
sudo austin-tui -Cp <pid>
The -C
option will instruct Austin to look for child Python processes, and you
will be able to navigate through them with the arrow keys.
The TUI is based on
python-curses
. The version included with the standard Windows installations of Python is broken so it won't work out of the box. A solution is to install the the wheel of the port to Windows from this page. Wheel files can be installed directly withpip
, as described in the linked page.
Full mode
By default, Austin TUI shows you statistics of the last seen stack for each process and thread when the UI is refreshed (about every second). This is similar to what top does with all the running processes on your system.
If you want to see all the collected statistics, with the frame stacks
represented as a rooted tree, you can press F
to enter the Full mode. The
last seen stack will be highlighted so that you also have that information
available while in this mode.
Save statistics
Peeking at a running Python application is nice but in many cases you would want
to save the collected data for further offline analysis (for example, you might
want to represent it as a flame graph). At any point, whenever you want to dump
the collected data to a file, you can press the S
key and a file with all the
samples will be generated for you in the working directory, prefixed with
austin_
and followed by a timestamp. The TUI will notify of the successful
operation on the bottom-right corner.
Compatibility
Austin TUI has been tested with Python 3.6-3.9 and is known to work on Linux, macOS and Windows.
Since Austin TUI uses Austin to collect samples, the same note applies here:
Due to the System Integrity Protection introduced in macOS with El Capitan, Austin cannot profile Python processes that use an executable located in the
/bin
folder, even withsudo
. Hence, either run the interpreter from a virtual environment or use a Python interpreter that is installed in, e.g.,/Applications
or viabrew
with the default prefix (/usr/local
). Even in these cases, though, the use ofsudo
is required.
As for Linux users, the use of sudo
can be avoided by granting Austin the
cap_sys_ptrace
capability with, e.g.
sudo setcap cap_sys_ptrace+ep `which austin`
Contribute
If you like Austin TUI and you find it useful, there are ways for you to contribute.
If you want to help with the development, then have a look at the open issues and have a look at the contributing guidelines before you open a pull request.
You can also contribute to the development of the Austin TUI by becoming a sponsor and/or by buying me a coffee on BMC or by chipping in a few pennies on PayPal.Me.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file austin-tui-1.0.1.tar.gz
.
File metadata
- Download URL: austin-tui-1.0.1.tar.gz
- Upload date:
- Size: 38.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.10.0 Linux/5.8.0-1042-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0432b307af3c2d7e31728a1838d83cb2d866f688d7a8b3fe38fe7c0eb8b2cf0f |
|
MD5 | 81a590dd505666704541fc0da05e6e9b |
|
BLAKE2b-256 | 932cd1c481632fb4f8d33e072e784ea7458df39bf1b986b5252c58d454c46b2c |
File details
Details for the file austin_tui-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: austin_tui-1.0.1-py3-none-any.whl
- Upload date:
- Size: 53.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.10.0 Linux/5.8.0-1042-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22397b369e27c42237ef5fb28e76642d305e80623b4ba556df0e9ffc5d7af81d |
|
MD5 | dc715bc59ae03f396132bebeaa33df1e |
|
BLAKE2b-256 | 480f9bb990b3a8fe7a20bc8d087117a59686cc02fe9e75a4c92352f9b4a3ba4d |