Skip to content

Commit

Permalink
docs: use new art
Browse files Browse the repository at this point in the history
Also fixed a minor regression and linting errors.
  • Loading branch information
P403n1x87 committed Nov 6, 2021
1 parent e0819b7 commit 8a05d1e
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 2 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<kbd>&larr;</kbd> and <kbd>&rarr;</kbd> 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
Expand Down Expand Up @@ -164,13 +173,31 @@ operation on the bottom-right corner.
alt="Austin TUI - Save notification" />
</p>

If you run the Austin TUI inside VS Code, you can benefit from the editor's
terminal features, like using <kbd>Ctrl</kbd>/<kbd>Cmd</kbd>+<kbd>Left-Click</kbd>
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.

<p align="center">
<img src="art/austin-tui-vscode.gif"
style="box-shadow: #111 0px 0px 16px;"
alt="Austin TUI" />
</p>

## Threshold

The statistics reported by the TUI might be overwhelming, especially in full
mode. To reduce the amout of data that gets displayed, the keys <kbd>+</kbd> and
<kbd>-</kbd> can be used to increase or lower the `%TOTAL` threshold

<p align="center">
<img src="art/austin-tui-threshold.png"
style="box-shadow: #111 0px 0px 16px;"
alt="Austin TUI - Threshold demonstration" />
</p>


# Compatibility

Austin TUI has been tested with Python 3.6-3.10 and is known to work on
Expand Down Expand Up @@ -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
Binary file modified art/austin-tui-full-mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified art/austin-tui-normal-mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified art/austin-tui-save.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/austin-tui-threshold.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/austin-tui-vscode.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified art/austin-tui.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion austin_tui/view/austin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -211,5 +213,5 @@ def set_pid(self, pid: int, children: bool) -> None:
self.pid.set_text(self.markup(f"<pid><b>{pid}</b></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]))
5 changes: 4 additions & 1 deletion austin_tui/widgets/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions austin_tui/widgets/scroll.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 8a05d1e

Please sign in to comment.