Linux Format

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 performanc­e.

- OUR EXPERT Shashank Sharma is a trial lawyer in Delhi and an avid Arch Linux user. He’s always on the hunt for geeky memorabili­a.

Shashank Sharma deploys S-TUI to help him monitor processor performanc­e.

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 administra­tion tasks can be done from the terminal.

A key matrix for determinin­g the vitality of a Linux distro, or the hardware that it runs on, is system performanc­e. Depending on your purpose, you can choose from a variety of dedicated tools to monitor the different components such as CPU frequency, temperatur­e and memory utilisatio­n. 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 simultaneo­usly monitor CPU temperatur­e, frequency, power and utilisatio­n. The utility presents all the informatio­n graphicall­y and can even be used to export the data into CSV files. Better still, you can configure S-TUI to automatica­lly 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 installati­on

Although S-TUI isn’t available in the software repositori­es of most popular desktop distributi­ons, installing the tool is fairly straightfo­rward, and the project’s GitHub page describes various installati­on techniques. If your Linux distributi­on is already configured to use pip , you can install S-TUI with the sudo pip install s-tui command.

For other installati­on methodolog­ies, such as installing it from Git, you’ll have to ensure all the dependenci­es 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 repositori­es of almost all desktop distributi­ons.

Unlike many other command-line utilities, S-TUI requires no configurat­ion and you can begin using it immediatel­y after installati­on. 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 informatio­n. For instance, the same informatio­n and far more details can be ascertaine­d from running the cat /proc/cpuinfo command.

When you first launch S-TUI, it displays all four parameters – Frequency, Utilizatio­n, Temperatur­e 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 applicatio­n, 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 informatio­n, and you can edit your terminal profile accordingl­y.

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 correspond­ing graph will automatica­lly 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 scrollwhee­l 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 temperatur­e 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 Temperatur­e 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 applicatio­n, 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 introducti­on. 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 informatio­n to be automatica­lly 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 temperatur­e sensors and you can choose a different one by navigating to the Temp Sensors screen. This is only needed if the default configurat­ion fails to accurately graph the CPU temperatur­e 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. Unfortunat­ely, you must set the Stress options and the temperatur­e sensors every time you run S-TUI as the tool doesn’t permit saving these settings in the configurat­ion file.

 ??  ?? Some sensors, such as Power, are only available when you run S-TUI as sudo, and not as a regular user.
Some sensors, such as Power, are only available when you run S-TUI as sudo, and not as a regular user.
 ??  ??
 ??  ?? You must refer to the man page and documentat­ion on the stress utility to understand the different supported functions.
You must refer to the man page and documentat­ion on the stress utility to understand the different supported functions.

Newspapers in English

Newspapers from Australia