diff --git a/README.md b/README.md index 02bca6e..8cb10e9 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,15 @@ will be able to navigate through them with the arrow keys. > [linked](https://pip.pypa.io/en/latest/user_guide/#installing-from-wheels) > page. +## Thread navigation + +Profiling data is processed on a per-thread basis. The total number of threads +(across all processes, if sampling child processes) is displayed in the +top-right corner of the TUI. To navigate to a different thread, use the + and arrows. The PID and TID of the currently +selected thread will appear in the middle of the top bar in the TUI. + + ## Full mode By default, Austin TUI shows you statistics of the last seen stack for each @@ -164,6 +173,17 @@ operation on the bottom-right corner. alt="Austin TUI - Save notification" />

+If you run the Austin TUI inside VS Code, you can benefit from the editor's +terminal features, like using Ctrl/Cmd+Left-Click +to hop straight into a source file at a given line. You can also leverage the +TUI's save feature to export the collected samples and import them into the +[Austin VS Code] extension to also get a flame graph representation. + +

+ Austin TUI +

## Threshold @@ -171,6 +191,13 @@ The statistics reported by the TUI might be overwhelming, especially in full mode. To reduce the amout of data that gets displayed, the keys + and - can be used to increase or lower the `%TOTAL` threshold +

+ Austin TUI - Threshold demonstration +

+ + # Compatibility Austin TUI has been tested with Python 3.6-3.10 and is known to work on @@ -218,4 +245,5 @@ on BMC or by chipping in a few pennies on [Austin]: https://github.com/P403n1x87/austin [austin-python]: https://github.com/P403n1x87/austin-python#installation [Austin installation]: https://github.com/P403n1x87/austin#installation +[Austin VS Code]: https://marketplace.visualstudio.com/items?itemName=p403n1x87.austin-vscode [The Austin TUI Way to Resourceful Text-based User Interfaces]: https://p403n1x87.github.io/the-austin-tui-way-to-resourceful-text-based-user-interfaces.html diff --git a/art/austin-tui-full-mode.png b/art/austin-tui-full-mode.png index 0a5d064..bde3989 100644 Binary files a/art/austin-tui-full-mode.png and b/art/austin-tui-full-mode.png differ diff --git a/art/austin-tui-normal-mode.png b/art/austin-tui-normal-mode.png index 0686699..31c294a 100644 Binary files a/art/austin-tui-normal-mode.png and b/art/austin-tui-normal-mode.png differ diff --git a/art/austin-tui-save.png b/art/austin-tui-save.png index baac267..452b0d2 100644 Binary files a/art/austin-tui-save.png and b/art/austin-tui-save.png differ diff --git a/art/austin-tui-threshold.png b/art/austin-tui-threshold.png new file mode 100644 index 0000000..b87c55f Binary files /dev/null and b/art/austin-tui-threshold.png differ diff --git a/art/austin-tui-vscode.gif b/art/austin-tui-vscode.gif new file mode 100644 index 0000000..3084d16 Binary files /dev/null and b/art/austin-tui-vscode.gif differ diff --git a/art/austin-tui.gif b/art/austin-tui.gif index 955bd57..3e8ca8d 100644 Binary files a/art/austin-tui.gif and b/art/austin-tui.gif differ diff --git a/austin_tui/view/austin.py b/austin_tui/view/austin.py index 2e6a983..c9d3fa9 100644 --- a/austin_tui/view/austin.py +++ b/austin_tui/view/austin.py @@ -105,11 +105,13 @@ async def on_table_pgdown(self, data: Any = None) -> bool: return False async def on_table_home(self, _: Any = None) -> bool: + """Handle Home key on the table widget.""" self.stats_view.top() self.stats_view.refresh() return False async def on_table_end(self, _: Any = None) -> bool: + """Handle End key on the table widget.""" self.stats_view.bottom() self.stats_view.refresh() return False @@ -211,5 +213,5 @@ def set_pid(self, pid: int, children: bool) -> None: self.pid.set_text(self.markup(f"{pid}")) def set_python(self, version: str) -> None: - """Set the Python version""" + """Set the Python version.""" self.python.set_text(".".join([str(_) for _ in version])) diff --git a/austin_tui/widgets/label.py b/austin_tui/widgets/label.py index f0c4681..1605c93 100644 --- a/austin_tui/widgets/label.py +++ b/austin_tui/widgets/label.py @@ -128,7 +128,10 @@ def draw(self) -> bool: return False if isinstance(self.text, AttrString): - win.addstr(self.y, self.x, " " * width, self.attr) + try: + win.addstr(self.y, self.x, " " * width, self.attr) + except curses.error: + pass x = self.x if self.align == TextAlign.RIGHT and len(self.text) < width: x += width - len(self.text) diff --git a/austin_tui/widgets/scroll.py b/austin_tui/widgets/scroll.py index a6c562d..4f12e84 100644 --- a/austin_tui/widgets/scroll.py +++ b/austin_tui/widgets/scroll.py @@ -106,10 +106,12 @@ def scroll_up(self, lines: int = 1) -> None: self._draw_scroll_bar() def top(self) -> None: + """Scroll to the top.""" self.curr_y = 0 self._draw_scroll_bar() def bottom(self) -> None: + """Scroll to the bottom.""" self.curr_y = self.h - self.height self._draw_scroll_bar()