S-TUI: Stress-test your CPU

The nifty lit­tle S-TUI is an el­e­gant com­mand-line ap­pli­ca­tion to mon­i­tor your CPU and run a stress test

Linux User & Developer - - Contents -

Use S-TUI to mon­i­tor your CPU and run a stress test from the com­mand line

The Linux com­mand-line of­fers a vast ar­ray of use­ful ap­pli­ca­tions for a host of dif­fer­ent use cases. Ev­ery­thing from ev­ery­day text edit­ing, con­nect­ing with re­mote machines, per­form­ing back­ups and other ad­min­is­tra­tion tasks can be done from the ter­mi­nal. Mon­i­tor­ing your sys­tem’s per­for­mance is no ex­cep­tion. De­pend­ing on your pur­pose, you can choose from a va­ri­ety of ded­i­cated ap­pli­ca­tions to mon­i­tor the dif­fer­ent com­po­nents such as CPU fre­quency, tem­per­a­ture, mem­ory util­i­sa­tion and so on.

With S-TUI, which is an ab­bre­vi­a­tion for StressTer­mi­nal UI, you can si­mul­ta­ne­ously mon­i­tor CPU tem­per­a­ture, fre­quency, power and util­i­sa­tion. It presents all the in­for­ma­tion graph­i­cally and can even be used to export the data into CSV files. Bet­ter still, you can con­fig­ure the tool to au­to­mat­i­cally launch scripts when the val­ues of any of the com­po­nents be­ing mon­i­tored breaches the de­fined thresh­old val­ues. When cou­pled with stress, an­other com­mand-line util­ity, the tool can also stress-test your sys­tem.

Not many Linux dis­tri­bu­tions carry S-TUI in their soft­ware repos­i­to­ries, but in­stal­la­tion is fairly straight­for­ward. The project’s GitHub page de­scribes var­i­ous in­stal­la­tion tech­niques. If your sys­tem is al­ready con­fig­ured to use pip, you can in­stall S-TUI with the sudo pip in­stall s-tui com­mand. If you de­cide to in­stall it from the Git repos­i­to­ries in­stead, you’ll have to man­u­ally in­stall its de­pen­den­cies – ur­wid and psu­til. You can in­stall these Python pack­ages us­ing your distri­bu­tion’s pack­age man­age­ment tool.

You can now be­gin us­ing the tool to mon­i­tor your sys­tem’s per­for­mance. If you would also like to stresstest the CPU, S-TUI sup­ports both the stress and stress-ng util­i­ties. Most dis­tri­bu­tions ship these in their soft­ware repos­i­to­ries, and you can in­stall them us­ing your distri­bu­tion’s pack­age man­age­ment tool.

Use S-TUI

Un­like many other com­mand-line util­i­ties, S-TUI re­quires no con­fig­u­ra­tion and you can be­gin us­ing it im­me­di­ately af­ter in­stal­la­tion. Run the s-tui com­mand to launch the tool. At the top of the side­bar on the left are the de­tails about your CPU. Our Len­ovo test ma­chine was cor­rectly iden­ti­fied as In­tel Core i3-5005U CPU @ 2.00 GHz. S-TUI uses var­i­ous other na­tive tools and util­i­ties to gather the rel­e­vant in­for­ma­tion; for in­stance, the same in­for­ma­tion, and far greater de­tails, can be ascertained from run­ning the cat /proc/cpuinfo com­mand.

When you first launch S-TUI, it dis­play all four pa­ram­e­ters – Fre­quency, Uti­liza­tion, Tem­per­a­ture and Power, and refreshes the data for each ev­ery sec­ond.

You can change the re­fresh rate by chang­ing the value of Re­fresh[s]:1.0 on the side­bar.

De­pend­ing on your ter­mi­nal ap­pli­ca­tion, and the colour scheme, you may not be able to clearly see the dif­fer­ent el­e­ments on the S-TUI in­ter­face. Should this hap­pen, switch to a ba­sic White-on-Black colour scheme and run S-TUI. This should tell you all the colours used by the tool and you can then make changes to your pro­file ac­cord­ingly.

You can nav­i­gate the side­bar us­ing the H and J keys, much like you would in vim, or use the Up and Down keys on the key­board. The de­fault mode for the tool is to mon­i­tor your sys­tem, which is ev­i­dent from the (X) next to Mon­i­tor on the side­bar. If you in­stalled the stress util­ity as well, you can en­able it by nav­i­gat­ing to the Stress en­try on the side­bar and press­ing Space. You’ll no­tice the empty brack­ets are re­placed with (X) now.

You can sim­i­larly en­able or dis­able mon­i­tor­ing of the dif­fer­ent com­po­nents. When you dis­able a com­po­nent, the cor­re­spond­ing graph will au­to­mat­i­cally dis­ap­pear from the in­ter­face.

Un­like most other com­mand-line util­i­ties, S-TUI can also be con­trolled with the mouse. Left-click on an en­try to se­lect it. You must still hit Es­cape to re­turn to the main screen and use the ar­row keys to scroll through the side­bar, as the scroll-wheel on your mouse won’t work with S-TUI. If for some rea­son you want to dis­able the mouse, start S-TUI with s-tui -nm.

You can also switch to a dif­fer­ent tem­per­a­ture sen­sor from within the tool it­self, if you be­lieve the graph is in­ac­cu­rate. Nav­i­gate to the Temp Sen­sors > en­try on the side­bar, and press En­ter. This opens the Avail­able Tem­per­a­ture Sen­sors di­a­logue, and you can then se­lect one from the list. As be­fore, af­ter nav­i­gat­ing to an en­try in the list, press Spacer to se­lect it. Re­mem­ber to se­lect Ap­ply for the changes to take ef­fect.

Hit Es­cape to re­turn to the main screen of the ap­pli­ca­tion, such as from the About, Help or Temp Sen­sors sec­tion. While the graph­i­cal in­ter­face for the tool also has a Help sec­tion in the side­bar, it pro­vides lit­tle more than a quick in­tro­duc­tion. For a com­plete list of all the sup­ported com­mand op­tions, run s-tui help.

Fur­ther con­fig­u­ra­tion

If you want to save the re­sult of the per­for­mance mon­i­tor­ing, use s-tui -c. This launches the util­ity as be­fore, but when you now exit the tool by press­ing Q, the col­lected data will be stored in the user’s home directory. You can then view the s-tu­i_log_<TIME>.csv file in your pre­ferred text ed­i­tor. You can also pro­vide a cus­tom name for the CSV log file with s-tui -c <path_­to_CSV_­file>.

An­other use­ful com­mand op­tion is -j, which can be used to show the cur­rent sta­tus of the ma­chine in JSON for­mat, like this:

S-TUI sup­ports a num­ber of dif­fer­ent tem­per­a­ture sen­sors and you can choose a dif­fer­ent one by nav­i­gat­ing to the Temp Sen­sors screen. This is only needed if the de­fault con­fig­u­ra­tion fails to ac­cu­rately graph the CPU tem­per­a­ture (for ex­am­ple, if the read­ings seem sig­nif­i­cantly way off).

All the ba­sic set­tings , such as the re­fresh rate (in sec­onds), and which com­po­nents to graph by de­fault are stored in the ~/.con­fig/s-tui/s-tui.conf file. Un­for­tu­nately, you must set the Stress op­tions and the tem­per­a­ture sen­sors man­u­ally ev­ery time you run S-TUI, as the tool doesn’t per­mit sav­ing these set­tings in the con­fig­u­ra­tion file.

Thresh­old scripts

In ad­di­tion to the s-tui.conf file, the ~/.con­fig/s-tui directory con­tains a directory called hooks-d. Within this directory you can place cus­tom scripts you want to ex­e­cute when a cer­tain thresh­old, such as CPU tem­per­a­ture, fre­quency or sim­i­lar, is ex­ceeded.

S-TUI sup­ports track­ing of four dif­fer­ent sources and you can use any of these sources to cre­ate cus­tom scripts. The name of the script must be <name>source. sh, where <name> is the name of the sup­ported source. While you can use S-TUI to track var­i­ous sources, for now it only sup­ports run­ning scripts based on CPU tem­per­a­ture thresh­old set­ting.

The de­fault thresh­old value for the CPU tem­per­a­ture is 80 de­grees C. To change this value, in­voke S-TUI with s-tui --t_thresh <value>. You can then save the new thresh­old value into the ~/.con­fig/s-tui/s-tui.conf file by sav­ing the set­tings from within the tool it­self. When you now open the s-tui.conf file in a text ed­i­tor, you’ll find a new en­try show­ing the newly de­fined tem­per­a­ture thresh­old value:

While the stress-test­ing fea­ture is prob­a­bly of lit­tle use to home and ca­sual Linux users, there’s no deny­ing the ben­e­fit of graph­i­cal rep­re­sen­ta­tion of the col­lected data for ad­min­is­tra­tors and pro­gram­mers. On the other hand, it’s also a use­ful way of see­ing what’s go­ing on with your CPU if you sus­pect it’s be­ing throt­tled in some way, or oth­er­wise not per­form­ing as it should.

Above Some in­for­ma­tion, such as Perf Lost, is only avail­able when you run the tool as root user

Above En­able the ‘Smooth Graph’ op­tion on the side­bar for a bet­ter graph­i­cal rep­re­sen­ta­tion of the col­lected data

Above Re­fer to the man page and doc­u­men­ta­tion on stress util­ity to un­der­stand its sup­ported func­tions

Newspapers in English

Newspapers from UK

© PressReader. All rights reserved.