c– 使用AMD FX 4100四核在linux ubuntu 12.10上获得CPU温度

c– 使用AMD FX 4100四核在linux ubuntu 12.10上获得CPU温度,第1张

概述有很多类似的问题,但我没有在那里找到解决方案.如何在不调用传感器的情况下在Linux Ubuntu 12.10上获得C或C的CPU温度?我当然可以从文件中读取它,但是我找不到它在12.10中的存储位置.并且只是简单地阅读文本文件的可能性或者我可以使用系统调用或信号查询内核吗?我的文件夹/ p​​roc / acpi /的内容就是event wakeup 没

有很多类似的问题,但我没有在那里找到解决方案.

如何在不调用传感器的情况下在Linux Ubuntu 12.10上获得C或C的cpu温度?我当然可以从文件中读取它,但是我找不到它在12.10中的存储位置.并且只是简单地阅读文本文件的可能性或者我可以使用系统调用或信号查询内核吗?

我的文件夹/ p​​roc / acpi /的内容就是

event  wakeup

没有THEMP0那里或类似的东西.然而,传感器应用可以在我的机器上显示温度.

no / sys / class / thermal / thermal_zone0 /目录

在/ sys / class / thermal我有

cooling_device0@  cooling_device1@  cooling_device2@  cooling_device3@

我正在尝试浏览lm-sensors源代码以寻找它如何检索温度,到目前为止无济于事,但我很接近.该文件是

http://lm-sensors.org/browser/lm-sensors/trunk/lib/sysfs.c

特别是:

第846行:

846 int sensors_read_sysfs_attr(const sensors_chip_name *name,847                             const sensors_subfeature *subfeature,848                             double *value)
最佳答案根据sysfs documentation,传感器信息存储在/ sys / class / hwmon下,每个芯片有不同的目录.这与我在Ubuntu 13.10上看到的输出一致.

传感器使用的文件是:

/sys/class/hwmon/hwmon*/device/temP*

根据芯片/虚拟设备的数量,可以有许多hwmon目录.

我的双核系统输出:

$pwd/sys/class/hwmon$ls -ltotal 0lrwxrwxrwx 1 root root 0 May 17 14:29 hwmon0 -> ../../devices/virtual/hwmon/hwmon0lrwxrwxrwx 1 root root 0 May 17 14:29 hwmon1 -> ../../devices/platform/coretemp.0/hwmon/hwmon1lrwxrwxrwx 1 root root 0 May 17 14:29 hwmon2 -> ../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/hwmon/hwmon2

其中hwmon1是我的cpu的一个:

$pwd/sys/class/hwmon/hwmon1/device$ls -ltotal 0lrwxrwxrwx 1 root root    0 May 17 14:29 driver -> ../../../bus/platform/drivers/coretempdrwxr-xr-x 3 root root    0 May 17 14:29 hwmon-r--r--r-- 1 root root 4096 May 17 23:21 modalias-r--r--r-- 1 root root 4096 May 17 14:29 namedrwxr-xr-x 2 root root    0 May 17 23:21 powerlrwxrwxrwx 1 root root    0 May 17 14:29 subsystem -> ../../../bus/platform-r--r--r-- 1 root root 4096 May 17 14:29 temp2_crit-r--r--r-- 1 root root 4096 May 17 14:29 temp2_crit_alarm-r--r--r-- 1 root root 4096 May 17 14:29 temp2_input-r--r--r-- 1 root root 4096 May 17 23:11 temp2_label-r--r--r-- 1 root root 4096 May 17 14:29 temp2_max-r--r--r-- 1 root root 4096 May 17 14:29 temp3_crit-r--r--r-- 1 root root 4096 May 17 14:29 temp3_crit_alarm-r--r--r-- 1 root root 4096 May 17 14:29 temp3_input-r--r--r-- 1 root root 4096 May 17 23:11 temp3_label-r--r--r-- 1 root root 4096 May 17 14:29 temp3_max-rw-r--r-- 1 root root 4096 May 17 14:29 uevent

temp2 *和temp3 *的值分别对应于核心0和核心1.基本上这些是文件传感器从中读取数据.根据您的硬件设备,具有温度信息的cpu目录(在我的情况下为hwmon1)可能不同. 总结

以上是内存溢出为你收集整理的c – 使用AMD FX 4100四核在linux ubuntu 12.10上获得CPU温度全部内容,希望文章能够帮你解决c – 使用AMD FX 4100四核在linux ubuntu 12.10上获得CPU温度所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/1046586.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-24
下一篇2022-05-24

发表评论

登录后才能评论

评论列表(0条)

    保存