mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-03 23:40:14 +08:00
translated by cycoe
This commit is contained in:
parent
dbd9118c81
commit
8ec93b8da5
@ -1,166 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (cycoe)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Monitoring CPU and GPU Temperatures on Linux)
|
||||
[#]: via: (https://itsfoss.com/monitor-cpu-gpu-temp-linux/)
|
||||
[#]: author: (It's FOSS Community https://itsfoss.com/author/itsfoss/)
|
||||
|
||||
Monitoring CPU and GPU Temperatures on Linux
|
||||
======
|
||||
|
||||
_**Brief: This articles discusses two simple ways of monitoring CPU and GPU temperatures in Linux command line.**_
|
||||
|
||||
Because of **[Steam][1]** (including _[Steam Play][2]_ , aka _Proton_ ) and other developments, **GNU/Linux** is becoming the gaming platform of choice for more and more computer users everyday. A good number of users are also going for **GNU/Linux** when it comes to other resource-consuming computing tasks such as [video editing][3] or graphic design ( _Kdenlive_ and _[Blender][4]_ are good examples of programs for these).
|
||||
|
||||
Whether you are one of those users or otherwise, you are bound to have wondered how hot your computer’s CPU and GPU can get (even more so if you do overclocking). If that is the case, keep reading. We will be looking at a couple of very simple commands to monitor CPU and GPU temps.
|
||||
|
||||
My setup includes a [Slimbook Kymera][5] and two displays (a TV set and a PC monitor) which allows me to use one for playing games and the other to keep an eye on the temperatures. Also, since I use [Zorin OS][6] I will be focusing on **Ubuntu** and **Ubuntu** derivatives.
|
||||
|
||||
To monitor the behaviour of both CPU and GPU we will be making use of the useful `watch` command to have dynamic readings every certain number of seconds.
|
||||
|
||||
![][7]
|
||||
|
||||
### Monitoring CPU Temperature in Linux
|
||||
|
||||
For CPU temps, we will combine `watch` with the `sensors` command. An interesting article about a [gui version of this tool has already been covered on It’s FOSS][8]. However, we will use the terminal version here:
|
||||
|
||||
```
|
||||
watch -n 2 sensors
|
||||
```
|
||||
|
||||
`watch` guarantees that the readings will be updated every 2 seconds (and this value can — of course — be changed to what best fit your needs):
|
||||
|
||||
```
|
||||
Every 2,0s: sensors
|
||||
|
||||
iwlwifi-virtual-0
|
||||
Adapter: Virtual device
|
||||
temp1: +39.0°C
|
||||
|
||||
acpitz-virtual-0
|
||||
Adapter: Virtual device
|
||||
temp1: +27.8°C (crit = +119.0°C)
|
||||
temp2: +29.8°C (crit = +119.0°C)
|
||||
|
||||
coretemp-isa-0000
|
||||
Adapter: ISA adapter
|
||||
Package id 0: +37.0°C (high = +82.0°C, crit = +100.0°C)
|
||||
Core 0: +35.0°C (high = +82.0°C, crit = +100.0°C)
|
||||
Core 1: +35.0°C (high = +82.0°C, crit = +100.0°C)
|
||||
Core 2: +33.0°C (high = +82.0°C, crit = +100.0°C)
|
||||
Core 3: +36.0°C (high = +82.0°C, crit = +100.0°C)
|
||||
Core 4: +37.0°C (high = +82.0°C, crit = +100.0°C)
|
||||
Core 5: +35.0°C (high = +82.0°C, crit = +100.0°C)
|
||||
```
|
||||
|
||||
Amongst other things, we get the following information:
|
||||
|
||||
* We have 5 cores in use at the moment (with the current highest temperature being 37.0ºC).
|
||||
* Values higher than 82.0ºC are considered high.
|
||||
* A value over 100.0ºC is deemed critical.
|
||||
|
||||
|
||||
|
||||
[][9]
|
||||
|
||||
Suggested read Top 10 Command Line Games For Linux
|
||||
|
||||
The values above lead us to the conclusion that the computer’s workload is very light at the moment.
|
||||
|
||||
### Monitoring GPU Temperature in Linux
|
||||
|
||||
Let us turn to the graphics card now. I have never used an **AMD** dedicated graphics card, so I will be focusing on **Nvidia** ones. The first thing to do is download the appropriate, current driver through [additional drivers in Ubuntu][10].
|
||||
|
||||
On **Ubuntu** (and its forks such as **Zorin** or **Linux Mint** ), going to _Software & Updates_ > _Additional Drivers_ and selecting the most recent one normally suffices. Additionally, you can add/enable the official _ppa_ for graphics cards (either through the command line or via _Software & Updates_ > _Other Software_ ). After installing the driver you will have at your disposal the _Nvidia X Server_ gui application along with the command line utility _nvidia-smi_ (Nvidia System Management Interface). So we will use `watch` and `nvidia-smi`:
|
||||
|
||||
```
|
||||
watch -n 2 nvidia-smi
|
||||
```
|
||||
|
||||
And — the same as for the CPU — we will get updated readings every two seconds:
|
||||
|
||||
```
|
||||
Every 2,0s: nvidia-smi
|
||||
|
||||
Fri Apr 19 20:45:30 2019
|
||||
+-----------------------------------------------------------------------------+
|
||||
| Nvidia-SMI 418.56 Driver Version: 418.56 CUDA Version: 10.1 |
|
||||
|-------------------------------+----------------------+----------------------+
|
||||
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
|
||||
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|
||||
|===============================+======================+======================|
|
||||
| 0 GeForce GTX 106... Off | 00000000:01:00.0 On | N/A |
|
||||
| 0% 54C P8 10W / 120W | 433MiB / 6077MiB | 4% Default |
|
||||
+-------------------------------+----------------------+----------------------+
|
||||
|
||||
+-----------------------------------------------------------------------------+
|
||||
| Processes: GPU Memory |
|
||||
| GPU PID Type Process name Usage |
|
||||
|=============================================================================|
|
||||
| 0 1557 G /usr/lib/xorg/Xorg 190MiB |
|
||||
| 0 1820 G /usr/bin/gnome-shell 174MiB |
|
||||
| 0 7820 G ...equest-channel-token=303407235874180773 65MiB |
|
||||
+-----------------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
The chart gives the following information about the graphics card:
|
||||
|
||||
* it is using the open source driver version 418.56.
|
||||
* the current temperature of the card is 54.0ºC — with the fan at 0% of its capacity.
|
||||
* the power consumption is very low: only 10W.
|
||||
* out of 6 GB of vram (video random access memory), it is only using 433 MB.
|
||||
* the used vram is being taken by three processes whose IDs are — respectively — 1557, 1820 and 7820.
|
||||
|
||||
|
||||
|
||||
[][11]
|
||||
|
||||
Suggested read Googler: Now You Can Google From Linux Terminal!
|
||||
|
||||
Most of these facts/values show that — clearly — we are not playing any resource-consuming games or dealing with heavy workloads. Should we started playing a game, processing a video — or the like —, the values would start to go up.
|
||||
|
||||
#### Conclusion
|
||||
|
||||
Althoug there are gui tools, I find these two commands very handy to check on your hardware in real time.
|
||||
|
||||
What do you make of them? You can learn more about the utilities involved by reading their man pages.
|
||||
|
||||
Do you have other preferences? Share them with us in the comments, ;).
|
||||
|
||||
Halof!!! (Have a lot of fun!!!).
|
||||
|
||||
![avatar][12]
|
||||
|
||||
### Alejandro Egea-Abellán
|
||||
|
||||
It’s FOSS Community Contributor
|
||||
|
||||
I developed a liking for electronics, linguistics, herpetology and computers (particularly GNU/Linux and FOSS). I am LPIC-2 certified and currently work as a technical consultant and Moodle administrator in the Department for Lifelong Learning at the Ministry of Education in Murcia, Spain. I am a firm believer in lifelong learning, the sharing of knowledge and computer-user freedom.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/monitor-cpu-gpu-temp-linux/
|
||||
|
||||
作者:[It's FOSS Community][a]
|
||||
选题:[lujun9972][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/itsfoss/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/install-steam-ubuntu-linux/
|
||||
[2]: https://itsfoss.com/steam-play-proton/
|
||||
[3]: https://itsfoss.com/best-video-editing-software-linux/
|
||||
[4]: https://www.blender.org/
|
||||
[5]: https://slimbook.es/
|
||||
[6]: https://zorinos.com/
|
||||
[7]: https://itsfoss.com/wp-content/uploads/2019/04/monitor-cpu-gpu-temperature-linux-800x450.png
|
||||
[8]: https://itsfoss.com/check-laptop-cpu-temperature-ubuntu/
|
||||
[9]: https://itsfoss.com/best-command-line-games-linux/
|
||||
[10]: https://itsfoss.com/install-additional-drivers-ubuntu/
|
||||
[11]: https://itsfoss.com/review-googler-linux/
|
||||
[12]: https://itsfoss.com/wp-content/uploads/2019/04/EGEA-ABELLAN-Alejandro.jpg
|
@ -0,0 +1,164 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (cycoe)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Monitoring CPU and GPU Temperatures on Linux)
|
||||
[#]: via: (https://itsfoss.com/monitor-cpu-gpu-temp-linux/)
|
||||
[#]: author: (It's FOSS Community https://itsfoss.com/author/itsfoss/)
|
||||
|
||||
在 Linux 上监控 CPU 和 GPU 温度
|
||||
======
|
||||
|
||||
_**摘要:本篇文章讨论了在 Linux 命令行中监控 CPU 和 GPU 温度的两种简单方式。**_
|
||||
|
||||
由于 **[Steam][1]**(包括 _[Steam Play][2]_,也就是我们所熟知的 _Proton_)和一些其他的发展,**GNU/Linux** 正在成为越来越多计算机用户的日常游戏平台的选择。也有相当一部分用户在遇到像[视频编辑][3]或图形设计等(_Kdenlive_ 和 _[Blender][4]_ 是这类应用程序中很好的例子)资源消耗型计算任务时,也会使用 **GNU/Linux**。
|
||||
|
||||
不管你是否是这些用户中的一员或其他用户,你也一定想知道你的电脑 CPU 和 GPU 能有多热(如果你想要超频的话更会如此)。如果情况是这样,那么继续读下去。我们会介绍两个非常简单的命令来监控 CPU 和 GPU 温度。
|
||||
|
||||
我的装置包括一台 [Slimbook Kymera][5] 和两台显示器(一台 TV 和一台 PC 监视器),使得我可以用一台来玩游戏,另一台来留意监控温度。另外,因为我使用 [Zorin OS][6],我会将关注点放在 **Ubuntu** 和 **Ubuntu** 的衍生发行版上。
|
||||
|
||||
为了监控 CPU 和 GPU 的行为,我们将利用实用的 `watch` 命令在每几秒钟之后动态地得到示数。
|
||||
|
||||
![][7]
|
||||
|
||||
### 在 Linux 中监控 CPU 温度
|
||||
|
||||
对于 CPU 温度,我们将结合使用 `watch` 与 `sensors` 命令。一篇关于[此工具的图形用户界面版本][8]的有趣文章已经在 It's FOSS 中介绍过了。然而,我们将在此处使用命令行版本:
|
||||
|
||||
```
|
||||
watch -n 2 sensors
|
||||
```
|
||||
|
||||
`watch` 保证了示数会在每 2 秒钟更新一次(-当然- 这个周期值能够根据你的需要去更改):
|
||||
|
||||
```
|
||||
Every 2,0s: sensors
|
||||
|
||||
iwlwifi-virtual-0
|
||||
Adapter: Virtual device
|
||||
temp1: +39.0°C
|
||||
|
||||
acpitz-virtual-0
|
||||
Adapter: Virtual device
|
||||
temp1: +27.8°C (crit = +119.0°C)
|
||||
temp2: +29.8°C (crit = +119.0°C)
|
||||
|
||||
coretemp-isa-0000
|
||||
Adapter: ISA adapter
|
||||
Package id 0: +37.0°C (high = +82.0°C, crit = +100.0°C)
|
||||
Core 0: +35.0°C (high = +82.0°C, crit = +100.0°C)
|
||||
Core 1: +35.0°C (high = +82.0°C, crit = +100.0°C)
|
||||
Core 2: +33.0°C (high = +82.0°C, crit = +100.0°C)
|
||||
Core 3: +36.0°C (high = +82.0°C, crit = +100.0°C)
|
||||
Core 4: +37.0°C (high = +82.0°C, crit = +100.0°C)
|
||||
Core 5: +35.0°C (high = +82.0°C, crit = +100.0°C)
|
||||
```
|
||||
|
||||
除此之外,我们还能得到如下信息:
|
||||
|
||||
* 我们有 5 个核心正在被使用(并且当前的最高温度为 37.0ºC)。
|
||||
* 温度超过 82.0ºC 会被认为是过热。
|
||||
* 超过 100.0ºC 的温度会被认为是超过临界值。
|
||||
|
||||
|
||||
|
||||
[推荐阅读:Linux 上排行前 10 的命令行游戏][9]
|
||||
|
||||
|
||||
根据以上的温度值我们可以得出结论,我的电脑目前的工作负载非常小。
|
||||
|
||||
### 在 Linux 中监控 GPU 温度
|
||||
|
||||
现在让我们来看看显示卡。我从来没使用过 **AMD** 的显示卡,因此我会将重点放在 **Nvidia** 的显示卡上。我们需要做的第一件事是从 [Ubuntu 的附加驱动][10] 中下载合适的最新驱动。
|
||||
|
||||
在 **Ubuntu**(**Zorin** 或 **Linux Mint** 也是相同的)中,进入_软件和更新_ > _附加驱动_选项,选择最新的可用驱动。另外,你可以添加或启用显示卡的官方 _ppa_(通过命令行或通过_软件和更新_ > _其他软件_来实现)。安装驱动程序后,你将可以使用 _Nvidia X Server_ 的 GUI 程序以及命令行工具 _nvidia-smi_(Nvidia 系统管理界面)。因此我们将使用 `watch` 和 `nvidia-smi`:
|
||||
|
||||
```
|
||||
watch -n 2 nvidia-smi
|
||||
```
|
||||
|
||||
与 CPU 的情况一样,我们会在每两秒得到一次更新的示数:
|
||||
|
||||
```
|
||||
Every 2,0s: nvidia-smi
|
||||
|
||||
Fri Apr 19 20:45:30 2019
|
||||
+-----------------------------------------------------------------------------+
|
||||
| Nvidia-SMI 418.56 Driver Version: 418.56 CUDA Version: 10.1 |
|
||||
|-------------------------------+----------------------+----------------------+
|
||||
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
|
||||
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|
||||
|===============================+======================+======================|
|
||||
| 0 GeForce GTX 106... Off | 00000000:01:00.0 On | N/A |
|
||||
| 0% 54C P8 10W / 120W | 433MiB / 6077MiB | 4% Default |
|
||||
+-------------------------------+----------------------+----------------------+
|
||||
|
||||
+-----------------------------------------------------------------------------+
|
||||
| Processes: GPU Memory |
|
||||
| GPU PID Type Process name Usage |
|
||||
|=============================================================================|
|
||||
| 0 1557 G /usr/lib/xorg/Xorg 190MiB |
|
||||
| 0 1820 G /usr/bin/gnome-shell 174MiB |
|
||||
| 0 7820 G ...equest-channel-token=303407235874180773 65MiB |
|
||||
+-----------------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
从这个表格中我们得到了关于显示卡的如下信息:
|
||||
|
||||
* 它正在使用版本号为 418.56 的开源驱动。
|
||||
* 显示卡的当前温度为 54.0ºC,并且风扇的使用量为 0%。
|
||||
* 电量的消耗非常低:仅仅 10W。
|
||||
* 总量为 6GB 的 vram(视频随机存取存储器),只使用了 433MB。
|
||||
* vram 正在被 3 个进程使用,他们的 ID 分别为 1557、1820 和 7820。
|
||||
|
||||
|
||||
|
||||
[推荐阅读:现在你可以在 Linux 终端中使用谷歌了!][11]
|
||||
|
||||
|
||||
大部分这些事实或数值都清晰地表明,我们没有在玩任何消耗系统资源的游戏或处理大负载的任务。当我们开始玩游戏、处理视频或其他类似任务时,这些值就会开始上升。
|
||||
|
||||
#### 结论
|
||||
|
||||
即便我们有 GUI 工具,但我还是发现这两个命令对于实时监控硬件非常的顺手。
|
||||
|
||||
你将如何去使用它们呢?你可以通过阅读他们的 man 手册来学习更多关于这些工具的使用技巧。
|
||||
|
||||
你有其他偏爱的工具吗?在评论里分享给我们吧 ;)。
|
||||
|
||||
玩得开心!
|
||||
|
||||
![化身][12]
|
||||
|
||||
### Alejandro Egea-Abellán
|
||||
|
||||
It's FOSS 社区贡献者
|
||||
|
||||
我对电子、语言学、爬虫学、计算机(尤其是 GNU/Linux 和 FOSS)有着浓厚兴趣。我通过了 LPIC-2 认证,目前在西班牙穆尔西亚教育部终身学习部们担任技术顾问和 Moodle(译注:Moodle 是一个开源课程管理系统)管理员。我是终身学习、知识共享和计算机用户自由的坚定信奉者。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/monitor-cpu-gpu-temp-linux/
|
||||
|
||||
作者:[It's FOSS Community][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[cycoe](https://github.com/cycoe)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/itsfoss/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/install-steam-ubuntu-linux/
|
||||
[2]: https://itsfoss.com/steam-play-proton/
|
||||
[3]: https://itsfoss.com/best-video-editing-software-linux/
|
||||
[4]: https://www.blender.org/
|
||||
[5]: https://slimbook.es/
|
||||
[6]: https://zorinos.com/
|
||||
[7]: https://itsfoss.com/wp-content/uploads/2019/04/monitor-cpu-gpu-temperature-linux-800x450.png
|
||||
[8]: https://itsfoss.com/check-laptop-cpu-temperature-ubuntu/
|
||||
[9]: https://itsfoss.com/best-command-line-games-linux/
|
||||
[10]: https://itsfoss.com/install-additional-drivers-ubuntu/
|
||||
[11]: https://itsfoss.com/review-googler-linux/
|
||||
[12]: https://itsfoss.com/wp-content/uploads/2019/04/EGEA-ABELLAN-Alejandro.jpg
|
Loading…
Reference in New Issue
Block a user