mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
183 lines
7.2 KiB
Markdown
183 lines
7.2 KiB
Markdown
[#]: subject: "How to Stress Test CPU in Linux"
|
|
[#]: via: "https://itsfoss.com/stress-test-cpu-linux/"
|
|
[#]: author: "Sagar Sharma https://itsfoss.com/author/sagar/"
|
|
[#]: collector: "lkxed"
|
|
[#]: translator: " "
|
|
[#]: reviewer: " "
|
|
[#]: publisher: " "
|
|
[#]: url: " "
|
|
|
|
How to Stress Test CPU in Linux
|
|
======
|
|
|
|
Stress testing your CPU is one of the best ways to check your processor's performance capabilities under heavy load and the system's temperature when that happens.
|
|
|
|
When you stress test the CPU, you can monitor the system's resources to see how they behave with the CPU at its peak workload. While the performance will not change compared to what the processor is capable of, the temperature may affect its operation if it is not well-equipped.
|
|
|
|
**Stress testing is essential for enthusiasts when building a new system**, especially if you plan to overclock the CPU later.
|
|
|
|
For instance, if your CPU gets too hot too quickly during the stress test. You need a better cooling solution by changing the CPU cooler, using a better airflow cabinet, etc.
|
|
|
|
Now that you have an idea about the benefits, I will walk you through the following ways to stress test the CPU in Linux:
|
|
|
|
- **Using GtkStressTesting (GUI method)**
|
|
- **Using stress and s-tui utility (CLI method)**
|
|
|
|
So let's start with the first one.
|
|
|
|
### Stress test Linux CPU using GUI method 🖥️
|
|
|
|
If you prefer using a GUI solution over the terminal, I have just the easiest method for you to stress-test your system.
|
|
|
|
There is a GUI utility **GtkStressTesting,** which helps you stress test and monitor temperature simultaneously. It provides various presets to stress-test the system and provides an ability to choose how many cores you want to work with during the test.
|
|
|
|
🚧
|
|
|
|
This tool is no more actively maintained on
|
|
|
|
[GitLab][1]
|
|
|
|
. But it works as expected.
|
|
|
|
GtkStressTesting is available as a Flatpak, so if you haven't already enabled Flatpak support, refer to our [Flatpak setup guide][2].
|
|
|
|
Once you have enabled Flatpak support, the GtkStressTesting utility can be installed using the following via the terminal (if not software center)
|
|
|
|
```
|
|
flatpak install flathub com.leinardi.gst
|
|
```
|
|
|
|
After the installation, you can start the GtkStressTesting utility from the system menu.
|
|
|
|
Here, I would recommend you click on the `Read all` button and enter the sudo password so the utility can fetch all the information of your system:
|
|
|
|
![Allow read all premissions for GtkStressTesting][3]
|
|
|
|
From here, you can choose how long you want to stress test your system (you can always stop the process if the temp gets too high) and choose the max number available in the `Workers: Auto`.
|
|
|
|
I went for **12 cores and 5 mins of stress testing**:
|
|
|
|
![choose time and cores to stress test the CPU in linux][4]
|
|
|
|
Once you are done, click on the start button and monitor the temperatures, and if they reach beyond 90, stop the stress testing.
|
|
|
|
My system went to 85 max during stress testing:
|
|
|
|
![stress test Linux CPU usng GUI][5]
|
|
|
|
Pretty easy way to stress test the CPU. Isn't it? 😉
|
|
|
|
### Stress test Linux CPU using the Terminal
|
|
|
|
![stress test using s-tui command utility][6]
|
|
|
|
You'd need two utilities to stress test using a terminal: **[s-tui][7]** and **stress**.
|
|
|
|
You can get these tools installed from the default repositories or [using pip][8]. It is easier with default repositories if you are okay with using an older version of the tool (a tad bit).
|
|
|
|
Here are the commands that will help you install them on popular Linux distros:
|
|
|
|
**For Ubuntu/Debian base:**
|
|
|
|
```
|
|
sudo apt install s-tui stress
|
|
```
|
|
|
|
**For Arch Linux:**
|
|
|
|
```
|
|
sudo pacman -S s-tui stress
|
|
```
|
|
|
|
**For Fedora/RHEL:**
|
|
|
|
```
|
|
sudo dnf install s-tui stress
|
|
```
|
|
|
|
**If you want to use pip** for the latest version, here is the command:
|
|
|
|
```
|
|
pip install s-tui --user
|
|
```
|
|
|
|
Once you are done with the installation, launch the s-tui utility in the terminal:
|
|
|
|
```
|
|
s-tui
|
|
```
|
|
|
|
And you would be met with the following:
|
|
|
|
![monitor clock speed, load and CPU utilization in Linux][9]
|
|
|
|
You can use the mouse or keyboard arrow keys to navigate through the menu, so click on the `Stres options` and choose how long you want to stress test the system **(in seconds):**
|
|
|
|
![set time for how long to stress test CPU in Linux][10]
|
|
|
|
And finally, select the `Stress` option, and it will start the stress testing for a specified period:
|
|
|
|
![stress test Linux CPU using terminal][11]
|
|
|
|
And if the temperature gets out of control, you can click on the `Quit` button to stop the stress test manually. Additionally, if you want to store the data in the `.csv` format, the tool gives you the feature.
|
|
|
|
To store the data, all you have to do is append the `-c` flag while starting the s-tui utility as shown:
|
|
|
|
```
|
|
s-tui -c
|
|
```
|
|
|
|
And if you want to save the file with a name to your liking, you'd have to use the `--csv-file` flag as shown:
|
|
|
|
```
|
|
s-tui --csv-file <name of file>.csv
|
|
```
|
|
|
|
For example, here, I named the file `Hello.scv`:
|
|
|
|
```
|
|
s-tui --csv-file Hello.scv
|
|
```
|
|
|
|
You can explore more about the tool on its [GitHub page][12].
|
|
|
|
### Happy System, Happy Life 😁
|
|
|
|
Not every user realizes the benefits of a stress test. Sometimes it scares them off with the idea of their system reaching its limits for no reason.
|
|
|
|
However, the test will help you quickly evaluate and monitor your system's condition. Things like **abnormal temperature spikes** and CPU being unable to handle what it is should help you identify hardware issues early on.
|
|
|
|
In either case, you can refer to our temperature monitoring resource if you want to [keep your CPU monitor in check][13] without performing stress tests.
|
|
|
|
You can also check out some of the [system monitoring tools][14] or [htop alternatives][15] for Linux to keep an eye on your system resources.
|
|
|
|
💬 _What do you think about stress testing your CPU in Linux? Do you think we should do it? Share your thoughts on it in the comments below._
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
via: https://itsfoss.com/stress-test-cpu-linux/
|
|
|
|
作者:[Sagar Sharma][a]
|
|
选题:[lkxed][b]
|
|
译者:[译者ID](https://github.com/译者ID)
|
|
校对:[校对者ID](https://github.com/校对者ID)
|
|
|
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
|
|
[a]: https://itsfoss.com/author/sagar/
|
|
[b]: https://github.com/lkxed/
|
|
[1]: https://gitlab.com:443/leinardi/gst
|
|
[2]: https://itsfoss.com/flatpak-guide/
|
|
[3]: https://itsfoss.com/content/images/2023/05/Allow-read-all-premissions-for-GtkStressTesting.png
|
|
[4]: https://itsfoss.com/content/images/2023/05/choose-time-and-cores-to-stress-test-the-CPU-in-linux.png
|
|
[5]: https://itsfoss.com/content/images/2023/05/stress-test-Linux-CPU-usng-GUI-1.png
|
|
[6]: https://itsfoss.com/content/images/2023/05/stress-test.gif
|
|
[7]: https://itsfoss.com/stress-terminal-ui/
|
|
[8]: https://itsfoss.com/install-pip-ubuntu/
|
|
[9]: https://itsfoss.com/content/images/2023/05/monitor-clock-speed--load-and-CPU-utilization-in-Linux.png
|
|
[10]: https://itsfoss.com/content/images/2023/05/set-time-for-how-long-to-stress-test-CPU-in-Linux.png
|
|
[11]: https://itsfoss.com/content/images/2023/05/stress-test-Linux-CPU-using-terminal.png
|
|
[12]: https://github.com:443/amanusk/s-tui
|
|
[13]: https://itsfoss.com/check-laptop-cpu-temperature-ubuntu/
|
|
[14]: https://itsfoss.com/linux-system-monitoring-tools/
|
|
[15]: https://itsfoss.com/htop-alternatives/ |