Stress Terminal UI 压力测试和监控工具
项目描述
压力终端用户界面:s-tui
Stress-Terminal UI,s-tui,从终端以图形方式监控 CPU 温度、频率、功率和利用率。
截屏
目录
它能做什么
- 监控您的 CPU 温度/利用率/频率/功率
- 显示由热节流引起的性能下降
- 不需要 X 服务器
- 用于给 CPU 施加压力的内置选项 (stress/stress-ng/FIRESTARTER)
用法
s-tui
安装简单
点子(x86 + ARM)
pip 提供了最新版本的 s-tui。
安装:
pip install s-tui --user
(这通常会在 ~/.local/bin/ 目录中创建一个可执行文件。确保它在您的 PATH 中)
以 root 身份安装
sudo pip install s-tui
您可能需要先python-dev
安装
使用 pipsi 在virtualenv中安装:
pipsi install s-tui
更多安装方法
Ubuntu(18.10 及更新版本)
sudo apt install s-tui
Ubuntu (18.04, 16.04)
PPA 可用但不是最新的
sudo add-apt-repository ppa:amanusk/python-s-tui
sudo apt-get update
sudo apt-get install python3-s-tui
Arch Linux,Manjaro
s-tui
在 Arch 存储库中:
sudo pacman -S s-tui
s-tui-git
跟随主分支,由@MauroMombelli维护
安装它:
yay -S s-tui-git
OpenSUSE
sudo zypper install s-tui
软呢帽
s-tui
在 Fedora存储库中:
sudo dnf install s-tui
选项
TUI interface:
The side bar houses the controls for the displayed graphs.
At the bottom, all sensors reading are presented in text form.
* Use the arrow keys or 'hjkl' to navigate the side bar
* Toggle between stressed and regular operation using the radio buttons in 'Modes'.
* If you wish to alternate stress defaults, you can do it in <Stress options>
* Select graphs to display in the <Graphs> menu
* Select summaries to display in the <Summaries> menu
* Use the <Reset> button to reset graphs and statistics
* If your system supports it, you can use the UTF-8 button to get a smoother graph
* Save your current configuration with the <Save Settings> button
* Press 'q' or the <Quit> button to quit
* Run `s-tui --help` to get this message and additional cli options
optional arguments:
-h, --help show this help message and exit
-d, --debug Output debug log to _s-tui.log
--debug-file DEBUG_FILE
Use a custom debug file. Default: _s-tui.log
-dr, --debug_run Run for 5 seconds and quit
-c, --csv Save stats to csv file
--csv-file CSV_FILE Use a custom CSV file. Default: s-tui_log_<TIME>.csv
-t, --terminal Display a single line of stats without tui
-j, --json Display a single line of stats in JSON format
-nm, --no-mouse Disable Mouse for TTY systems
-v, --version Display version
-tt T_THRESH, --t_thresh T_THRESH
High Temperature threshold. Default: 80
依赖项
s-tui 非常适合监控。如果您想给系统施加压力,请安装压力。然后压力选项将显示在 s-tui 中(可选)
sudo apt-get install stress
配置
s-tui 是一个独立的应用程序,可以开箱即用,不需要配置文件来驱动其核心功能。但是,当超过某个阈值(例如 CPU 温度)时运行脚本等附加功能确实需要创建一个配置目录。~/.config/s-tui
默认情况下将创建此目录。
保存配置
选择 <保存设置> 会将当前配置保存到~/.config/s-tui/s-tui.conf
. 如果您想恢复默认设置,只需删除该文件。
添加阈值脚本
s-tui 使您能够在超过某个阈值时运行任意 shell 脚本,例如您的 CPU 温度。您可以通过将 shell 文件添加到具有以下名称之一的目录来定义此自定义行为~/.config/s-tui/hooks.d
,具体取决于您对做出反应感兴趣的阈值:
tempsource.sh
: 超过 CPU 温度阈值时触发
如果 s-tui 在 hooks 目录中找到一个脚本,其名称为它支持的源名称,只要源的当前值保持在阈值之上,它就会每 30 秒运行一次该脚本。
请注意,目前仅支持 CPU 温度阈值挂钩。
从源代码运行
首先克隆存储库
git clone https://github.com/amanusk/s-tui.git
cd s-tui
以 [root] 或(本地用户)身份安装所需的依赖项
[sudo] pip install urwid (--user)
[sudo] pip install psutil (--user)
安装应力(可选)
sudo apt-get install stress
运行 .py 文件
python -m s_tui.s_tui
FIRESTARTER 的可选集成(通过子模块,不适用于所有系统)
FIRESTARTER是一个很好的工具,可以将您的系统压力发挥到极致。如果您愿意,可以将 FIRESTARTER 子模块集成到 s-tui 中。
要构建 FIRESTARTER:
git submodule init
git submodule update
cd ./FIRESTARTER
./code-generator.py
make
完成这些步骤后,您可以:
- 安装 FIRESTARTER 以使其可被 s-tui 访问,例如在 /usr/local/bin 中建立到 FIRESTARTER 的软链接。
- 从主项目目录运行 s-tui 并
python -m s_tui.s_tui
在 s-tui 中提供运行 FIRESTARTER 的选项
兼容性
s-tui 使用psutil探测硬件信息。如果您的硬件不受支持,您可能看不到所有信息。
s-tui 使用urwid作为图形引擎。urwid 仅适用于类 UNIX 系统
- 通过amd_energy驱动程序在第二代和更新的 Intel Core CPU (Sandy Bridge) 和 AMD 系列 17h CPU 上支持电源读取。
- s-tui 经测试可在 Raspberry-Pi 4、3、2、1 上运行
常问问题
问:这与 htop 有何不同?
A : s-tui 不是像 htop 这样的进程监视器。目的是监控您的 CPU 统计数据,并可以选择在重负载下测试系统。(想想 AIDA64 压力测试,而不是任务管理器)。
问:我正在使用没有 X 服务器的 TTY,并且 s-tui 在启动时崩溃
A:默认情况下,s-tui 处理鼠标输入。这会导致某些系统崩溃。尝试运行s-tui --no-mouse
问:我没有在侧边栏中看到所有统计数据。
A : 侧边栏是可滚动的,您可以使用 或 向下滚动或使用DOWN
或滚动j
到底部。您也可以考虑减小您在终端中使用的字体的大小。:)PG-DN
G
贡献
欢迎新问题和拉取请求:)
如果您发现错误,请使用提供的模板将其报告为新问题。
要打开拉取请求,请参阅CONTRIBUTING了解更多信息。
小费
如果你喜欢这项工作,请在 GitHub 上star。
比特币:1PPhYgecwvAN7utN2EotgTfy2mmLqzF8m3
以太币:0xc169699A825066f2F07E0b29C4082094b32A3F3e