Linux command
austin-tui 命令
网络
复制后可按需替换文件名、目录或参数。
常用示例
Profile a Python script
austin-tui python3 [path/to/script.py]
Attach to a running Python process
sudo austin-tui -p [pid]
Attach to a process and its child processes
sudo austin-tui -Cp [pid]
Profile memory usage
austin-tui -m python3 [path/to/script.py]
Profile with a custom sampling interval
austin-tui -i [200] python3 [path/to/script.py]
Sample for a limited duration
austin-tui -x [10] python3 [path/to/script.py]
说明
austin-tui is a top-like text-based user interface for Austin, the frame stack sampler for CPython. It provides a real-time terminal view of where a Python application spends its time or allocates memory, displaying CPU and memory usage plots alongside per-frame statistics. Austin works by reading the CPython interpreter's virtual memory to sample frame stacks, requiring zero instrumentation and imposing minimal overhead on the target application. austin-tui wraps this sampling data in a curses-based interface inspired by the Unix top command. The default view shows the last-seen stack for the current process and thread, refreshing approximately once per second. Pressing F switches to full mode, which displays a hierarchical tree of all collected frame statistics. Pressing G activates a live flame graph visualization. Thread navigation is done with the left and right arrow keys, with the current PID and TID shown in the header. Additional interactive keys include P to pause the display while sampling continues in the background, S to save collected profiling data to a timestamped file, and +/- to adjust the minimum percentage threshold for displayed frames. When running in a VS Code terminal, source file paths in the output support Ctrl+Click (Cmd+Click on macOS) navigation. Saved data can be loaded in the Austin VS Code extension for further flame graph analysis.
参数
- -p _pid_, --pid _pid_
- Attach to an existing Python process by its process ID.
- -C, --children
- Also sample child Python processes. Navigate between them with the arrow keys.
- -m, --memory
- Profile memory usage instead of wall-clock time.
- -c, --cpu
- Sample on-CPU stacks only, ignoring idle time.
- -i _microseconds_, --interval _microseconds_
- Set the sampling interval in microseconds (default is 100).
- -x _seconds_, --exposure _seconds_
- Sample for the given number of seconds only, then stop.
- -t _milliseconds_, --timeout _milliseconds_
- Approximate startup wait time; increase on slow machines (default is 100 ms).
FAQ
What is the austin-tui command used for?
austin-tui is a top-like text-based user interface for Austin, the frame stack sampler for CPython. It provides a real-time terminal view of where a Python application spends its time or allocates memory, displaying CPU and memory usage plots alongside per-frame statistics. Austin works by reading the CPython interpreter's virtual memory to sample frame stacks, requiring zero instrumentation and imposing minimal overhead on the target application. austin-tui wraps this sampling data in a curses-based interface inspired by the Unix top command. The default view shows the last-seen stack for the current process and thread, refreshing approximately once per second. Pressing F switches to full mode, which displays a hierarchical tree of all collected frame statistics. Pressing G activates a live flame graph visualization. Thread navigation is done with the left and right arrow keys, with the current PID and TID shown in the header. Additional interactive keys include P to pause the display while sampling continues in the background, S to save collected profiling data to a timestamped file, and +/- to adjust the minimum percentage threshold for displayed frames. When running in a VS Code terminal, source file paths in the output support Ctrl+Click (Cmd+Click on macOS) navigation. Saved data can be loaded in the Austin VS Code extension for further flame graph analysis.
How do I run a basic austin-tui example?
Run `austin-tui python3 [path/to/script.py]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -p _pid_, --pid _pid_ do in austin-tui?
Attach to an existing Python process by its process ID.