Stress-test your CPU
While Shashank Sharma isn’t fond of stress-testing the weighing scale, he’s fine with tools like S-TUI, which help him monitor CPU performance.
Shashank Sharma deploys S-TUI to help him monitor processor performance.
Over the past few years, we’ve introduced a blend of powerful and robust as well as nifty and nimble command-utilities that help you perform a variety of tasks. Everything from everyday text editing, connecting with remote machines, performing backups and other administration tasks can be done from the terminal.
A key matrix for determining the vitality of a Linux distro, or the hardware that it runs on, is system performance. Depending on your purpose, you can choose from a variety of dedicated tools to monitor the different components such as CPU frequency, temperature and memory utilisation. But if you favour the CLI, like us, you’ll rather enjoy working with S-TUI.
With S-TUI, which is an acronym for Stress-Terminal UI, you can simultaneously monitor CPU temperature, frequency, power and utilisation. The utility presents all the information graphically and can even be used to export the data into CSV files. Better still, you can configure S-TUI to automatically launch scripts when the values of any of the components being monitored breaches the defined threshold values. When coupled with stress, another command-line utility, S-TUI can also be used to stress-test your system.
Don’t stress over installation
Although S-TUI isn’t available in the software repositories of most popular desktop distributions, installing the tool is fairly straightforward, and the project’s GitHub page describes various installation techniques. If your Linux distribution is already configured to use pip , you can install S-TUI with the sudo pip install s-tui command.
For other installation methodologies, such as installing it from Git, you’ll have to ensure all the dependencies are installed. These include tools such as urwid and psutil. Although it isn’t a dependency, if you decide to use S-TUI to also stress-test your CPU, you should also install stress or stress-ng. Thankfully, these are offered in the software repositories of almost all desktop distributions.
Unlike many other command-line utilities, S-TUI requires no configuration and you can begin using it immediately after installation. Run the s-tui command to launch the utility.
At the top of the sidebar on the left are the details about your CPU. Our Lenovo test machine was correctly identified as running an Intel Core i3-5005U CPU @ 2.00GHz processor. This is because S-TUI utilises various other native tools and utilities to gather the relevant information. For instance, the same information and far more details can be ascertained from running the cat /proc/cpuinfo command.
When you first launch S-TUI, it displays all four parameters – Frequency, Utilization, Temperature and Power – and refreshes the data for each every second. You can change the refresh rate by changing the value of Refresh[s]:1.0 on the sidebar.
Depending on your terminal application, and the colour scheme, you may not be able to clearly see the different elements on the S-TUI interface. Should this happen, exit S-TUI, then switch to a basic White-onBlack colour scheme on your terminal emulator, and run S-TUI again. You should now be able to see all the different colours used by S-TUI to display all the collected information, and you can edit your terminal profile accordingly.
You can use the up and down arrow keys to navigate the sidebar, but S-TUI also supports the use of H and J to scroll, much like you would in Vim.
Added stress
By default, S-TUI is configured to only monitor your system. This is evident from the (X) next to Monitor on the sidebar. If you installed the stress utility as well, you can enable the stress feature by navigating to the Stress entry on the sidebar and pressing the spacebar. You’ll notice the empty brackets would be replaced with (X) now. You can similarly enable or disable monitoring of the different components. When you disable a component, the corresponding graph will automatically disappear from the interface.
Unlike most other command-line utilities, S-TUI can also be controlled with the mouse. You can left-click on an entry/option in the sidebar to select it. You must still hit Escape to return to the main screen and use the arrow keys to scroll through the sidebar as the scrollwheel on your mouse doesn’t work with S-TUI. To disable the mouse, you must invoke S-TUI with the s-tui
-nm command.
You can also switch to a different temperature sensor from within S-TUI itself, if you believe the graph is inaccurate. Navigate to the ‘Temp Sensors >’ entry on the sidebar, and press Enter. This opens the Available Temperature Sensors dialog, and you can then select one from the list. As before, after navigating to an entry in the list, press Spacebar to select it. Remember to select Apply for the changes to take effect.
You must hit Escape to return back to the main screen of the application, such as from the About> Help or Temp Sensors section.
While the graphical interface for S-TUI also has a Help section in the sidebar, it provides little more than a quick introduction. For a complete list of all the supported command options, you must run the s-tui –
help command.
The collected data is lost as soon as you exit S-TUI, because the tool doesn’t save it by default. If you want all the collected information to be automatically saved to a CSV file when you exit S-TUI, you must invoke the utility with the s-tui -c command. The collected data will be stored in the users’ home directory. You can then view the s-tui_log_
Another useful command option is -j , which can be used to print on the screen the current status of the machine in JSON format. The output generated by the
s-tui -j command is a record of the current status of the machine, and not a running log:
$ s-tui -j
{
“Frequency": {
“Avg": “1282.1”,
“Core 0": “1630.6”,
“Core 1": “1295.6”,
“Core 2": “1175.6”,
“Core 3": “1026.4” },
“Temp": {
“Acpitz,0": “48.0”, “PackageId0,0": “49.0”, “Core0,0": “47.0”, “Core1,0": “47.0”, “Pch_Wildcat_Point,0": “40.5” }, }
S-TUI supports a number of different temperature sensors and you can choose a different one by navigating to the Temp Sensors screen. This is only needed if the default configuration fails to accurately graph the CPU temperature on your machine.
All the basic settings such as the refresh rate (in seconds), and which components to graph by default are stored in ~/.config/s-tui/s-tui.conf. Unfortunately, you must set the Stress options and the temperature sensors every time you run S-TUI as the tool doesn’t permit saving these settings in the configuration file.