Debian Codegraph @

README.md

raw symbols SCIP
1 # The Stress Terminal UI: s-tui
2
3 [![PyPI version](https://badge.fury.io/py/s-tui.svg)](https://badge.fury.io/py/s-tui)
4 [![Downloads](https://pepy.tech/badge/s-tui/month)](https://pepy.tech/project/s-tui)
5
6 ![](https://github.com/amanusk/s-tui/blob/master/ScreenShots/s-tui-logo-small.png?raw=true)
7
8 Stress-Terminal UI, s-tui, monitors CPU temperature, frequency, power and utilization in a graphical way from the terminal.
9
10 ## Screenshot
11
12 ![](https://github.com/amanusk/s-tui/blob/master/ScreenShots/s-tui-1.0.gif?raw=true)
13
14 # Table of Contents
15
16 - [The Stress Terminal UI: s-tui](#the-stress-terminal-ui-s-tui)
17 - [Screenshot](#screenshot)
18 - [What it does](#what-it-does)
19 - [Usage](#usage)
20 - [Simple installation](#simple-installation)
21 - [pip (x86 ARM)](#pip-x86--arm)
22 - [More installation methods](#more-installation-methods)
23 - [Ubuntu (18.10 and newer)](#ubuntu-1810-and-newer)
24 - [Ubuntu (18.04, 16.04)](#ubuntu-1804-1604)
25 - [Debian (10 and newer)](#debian-10-and-newer)
26 - [Arch Linux, Manjaro](#arch-linux-manjaro)
27 - [OpenSUSE](#opensuse)
28 - [Fedora](#fedora)
29 - [Options](#options)
30 - [Throttle Indicators](#throttle-indicators)
31 - [Dependencies](#dependencies)
32 - [Configuration](#configuration)
33 - [Saving a configuration](#saving-a-configuration)
34 - [Adding threshold scripts](#adding-threshold-scripts)
35 - [Run from source code](#run-from-source-code)
36 - [Compatibility](#compatibility)
37 - [FAQ](#faq)
38 - [Development](#development)
39 - [Contributing](#contributing)
40 - [Tip](#tip)
41
42 ## What it does
43
44 - Monitoring your CPU temperature/utilization/frequency/power
45 - Shows performance dips caused by thermal throttling
46 - Requires no X-server
47 - Built-in CPU stress test (zero dependencies, works out of the box)
48 - Optional integration with external stress tools (stress/stress-ng)
49
50 ## Usage
51
52 ```
53 s-tui
54 ```
55
56 ## Simple installation
57
58 ### pip (x86 + ARM)
59
60 The most up to date version of s-tui is available with pip.
61
62 Install with:
63
64 ```
65 pip install s-tui --user
66 ```
67
68 (This usually creates an executable in ~/.local/bin/ dir. Make sure it is in your PATH)
69
70 To install as root
71
72 ```
73 sudo pip install s-tui
74 ```
75
76 You might need to install `python-dev` first
77
78 Installation in virtualenv with [pipsi](https://github.com/mitsuhiko/pipsi):
79
80 ```
81 pipsi install s-tui
82 ```
83
84 ## More installation methods
85
86 ### Ubuntu (18.10 and newer)
87
88 ```
89 sudo apt install s-tui
90 ```
91
92 ### Ubuntu (18.04, 16.04)
93
94 A PPA is available but is not up to date
95
96 ```
97 sudo add-apt-repository ppa:amanusk/python-s-tui
98 sudo apt-get update
99 sudo apt-get install python3-s-tui
100 ```
101
102 ### Debian (10 and newer)
103
104 ```
105 sudo apt install s-tui
106 ```
107
108 ### Arch Linux, Manjaro
109
110 `s-tui` is in the Arch repository:
111
112 ```
113 sudo pacman -S s-tui
114 ```
115
116 `s-tui-git` follows the master branch, maintained by [@MauroMombelli](https://github.com/MauroMombelli)
117
118 Install it with:
119 `yay -S s-tui-git`
120
121 ### OpenSUSE
122
123 ```
124 sudo zypper install s-tui
125 ```
126
127 ### Fedora
128
129 `s-tui` is in the Fedora [repository](https://src.fedoraproject.org/rpms/s-tui):
130
131 ```
132 sudo dnf install s-tui
133 ```
134
135 ## Options
136
137 ```
138 TUI interface:
139
140 The side bar houses the controls for the displayed graphs.
141 At the bottom, all sensors reading are presented in text form.
142
143 * Use the arrow keys or 'hjkl' to navigate the side bar
144 * Toggle between stressed and regular operation using the radio buttons in 'Modes'.
145 * If you wish to alternate stress defaults, you can do it in <Stress options>
146 * Select graphs to display in the <Graphs> menu
147 * Select summaries to display in the <Summaries> menu
148 * Use the <Reset> button to reset graphs and statistics
149 * If your system supports it, you can use the UTF-8 button to get a smoother graph
150 * Save your current configuration with the <Save Settings> button
151 * Press 'q' or the <Quit> button to quit
152
153 * Run `s-tui --help` to get this message and additional cli options
154
155 optional arguments:
156 -h, --help show this help message and exit
157 -d, --debug Output debug log to _s-tui.log
158 --debug-file DEBUG_FILE
159 Use a custom debug file. Default: _s-tui.log
160 -dr, --debug_run Run for 5 seconds and quit
161 -c, --csv Save stats to csv file
162 --csv-file CSV_FILE Use a custom CSV file. Default: s-tui_log_<TIME>.csv
163 -t, --terminal Display a single line of stats without tui
164 -j, --json Display a single line of stats in JSON format
165 -nm, --no-mouse Disable Mouse for TTY systems
166 -v, --version Display version
167 -tt T_THRESH, --t_thresh T_THRESH
168 High Temperature threshold. Default: 80
169
170 ```
171
172 ## Throttle Indicators
173
174 When CPU throttling is detected, s-tui changes the frequency graph and summary text color and appends a reason label. Labels may be combined with `/` (e.g. `T/W`).
175
176 **With root + `msr` module** (detailed per-core reasons via `IA32_THERM_STATUS`):
177
178 | Label | Meaning |
179 | ----- | ----------------------------------------------------- |
180 | `T` | Thermal — core temperature exceeded TjMax |
181 | `H` | PROCHOT — external thermal signal (VRM, GPU, battery) |
182 | `C` | Critical — near emergency shutdown temperature |
183 | `W` | Power limit — PL1/PL2 watt budget exceeded |
184 | `A` | Current limit — electrical current (amps) limit hit |
185 | `X` | Cross-domain — throttled by another domain (e.g. GPU) |
186
187 **Without root** (sysfs fallback, thermal only):
188
189 | Label | Meaning |
190 | ----- | -------------------------------------------- |
191 | `Tc` | Core thermal throttle |
192 | `Tp` | Package thermal throttle (affects all cores) |
193
194 When a temperature sensor exceeds the `high` value defined by the sensor, or a user configured threshold (default 80°C), the sensor summary text summary and associated graph will change color to indicate this.
195
196 ## Dependencies
197
198 s-tui includes a built-in CPU stress test that works out of the box with no extra dependencies. For better stress performance, install numpy:
199
200 ```
201 pip install s-tui[stress]
202 ```
203
204 or install numpy directly:
205
206 ```
207 pip install numpy
208 ```
209
210 When numpy is available, the built-in stresser uses mixed floating-point operations (multiply, sqrt, sin) for maximum thermal output. Without numpy, it falls back to hashlib SHA-256 hashing which still provides good CPU load.
211
212 For additional stress options (memory, I/O, sync workers), you can optionally install the external `stress` or `stress-ng` tool:
213
214 ```
215 sudo apt-get install stress
216 ```
217
218 ## Configuration
219
220 s-tui is a self-contained application that can run out-of-the-box and doesn't need config files to drive its core features. However, additional features like running scripts when a certain threshold has been exceeded (e.g. CPU temperature) does necessitate creating a config directory. This directory will be made in `~/.config/s-tui` by default.
221
222 ### Saving a configuration
223
224 Selecting \<Save Settings\> will save the current configuration to `~/.config/s-tui/s-tui.conf`. If you would like to restore defaults, simply remove the file.
225
226 ### Adding threshold scripts
227
228 s-tui gives you the ability to run arbitrary shell scripts when a certain threshold is surpassed, like your CPU temperature. You can define this custom behaviour by adding a shell file to the directory `~/.config/s-tui/hooks.d` with one of the following names, depending on what threshold you're interested in reacting to:
229
230 - `tempsource.sh`: triggered when the CPU temperature threshold is exceeded
231
232 If s-tui finds a script in the hooks directory with the name of a source it supports, it will run that script every 30 seconds as long as the current value of the source remains above the threshold.
233
234 Note that at the moment only CPU temperature threshold hooks are supported.
235
236 ## Run from source code
237
238 Start by cloning the repository
239
240 ```
241 git clone https://github.com/amanusk/s-tui.git
242 cd s-tui
243 ```
244
245 Install required dependencies as \[root\] or as (local user)
246
247 ```
248 [sudo] pip install urwid (--user)
249 [sudo] pip install psutil (--user)
250 ```
251
252 Install stress (optional)
253
254 ```
255 sudo apt-get install stress
256 ```
257
258 Run the .py file
259
260 ```
261 python -m s_tui.s_tui
262 ```
263
264 ## Compatibility
265
266 s-tui uses [psutil](https://github.com/giampaolo/psutil) to probe hardware information. If your hardware is not supported, you might not see all the information.
267
268 s-tui uses [urwid](https://github.com/urwid/urwid) as a graphical engine. urwid only works with UNIX-like systems
269
270 - Power read is supported on Intel Core CPUs of the second generation and newer (Sandy Bridge)
271 and on AMD Family 17h CPUs through the [amd_energy](https://www.kernel.org/doc/html/latest/hwmon/amd_energy.html) driver.
272 - s-tui tested to run on Raspberry-Pi 4,3,2,1
273
274 ## FAQ
275
276 **Q**: How is this different from htop?
277 **A**: s-tui is not a processes monitor like htop. The purpose is to monitor your CPU statistics and have an option to test the system under heavy load. (Think AIDA64 stress test, not task manager).
278
279 **Q**: I am using the TTY with no X server and s-tui crashes on start
280 **A**: By default, s-tui is handles mouse inputs. This causes some systems to crash. Try running `s-tui --no-mouse`
281
282 **Q**: I am not seeing all the stats in the sidebar.
283 **A**: The sidebar is scrollable, you can scroll down with `DOWN` or `j` or scroll to the bottom with `PG-DN` or `G`. You might consider also decreasing the size of the font that you use in your terminal.:)
284
285 ## Development
286
287 Install dev dependencies:
288
289 ```
290 pip install -e ".[test]"
291 pip install ruff==0.15.4 pyright==1.1.408
292 ```
293
294 Set up pre-commit hooks (runs ruff + pyright automatically before each push):
295
296 ```
297 pip install pre-commit
298 pre-commit install --hook-type pre-push
299 ```
300
301 Run checks manually:
302
303 ```
304 ruff check . # lint
305 ruff format --check . # format check
306 pyright s_tui/ # type check
307 pytest # tests
308 ```
309
310 Auto-fix lint and formatting:
311
312 ```
313 ruff check --fix .
314 ruff format .
315 ```
316
317 ## Contributing
318
319 New issues and Pull Requests are welcome :)
320
321 If you notice a bug, please report it as a new issue, using the provided template.
322
323 To open a Pull Request, please see [CONTRIBUTING](https://github.com/amanusk/s-tui/blob/master/CONTRIBUTING.md) for more information.
324
325 ## Tip
326
327 If you like this work, please star it on GitHub.
328
329 BTC: `1PPhYgecwvAN7utN2EotgTfy2mmLqzF8m3`
330 ETH: `0xc169699A825066f2F07E0b29C4082094b32A3F3e`