14

如何在 OS X 中获取 CPU 温度和风扇速度?

我知道信息是从IOHWSensorin获得的IOKit,但我无法找到任何关于如何准确执行此操作的可靠信息。

我找到了一篇带有示例程序的文章 - http://www.booktou.com/node/148/0321278542/ch10lev1sec7.html,但我得到的只是GPU温度。我确定一体式 Mac 上有 CPU 温度传感器,所以这意味着我做错了什么。

4

3 回答 3

8

这个名为 FanControl 的 Prefpane 的源代码是可用的;它显示温度和风扇速度:http ://www.lobotomo.com/products/FanControl/index.html

于 2010-02-08T20:23:23.697 回答
4

如果你安装了 npm,还有一个叫做macstats的 cli 工具。您可以使用以下方式安装它:

[sudo] npm install macstats -g

然后只需运行命令,它将为您提供如下输出:

--- CPU Stats ---
CPU Temp:        33.75°C

--- Fans Stats ---
Fan 0 speed:     1996 RPM
Fan 1 speed:     2003 RPM

--- Battery Stats ---
Charged:         82%
Capacity:        92%
Cycle Count:     692 (69%)
Max Cycle Count: 1000
Current Charge:  5189 mAh
Maximum Charge:  6316 mAh
Design Capacity: 6900 mAh
Time Remaining:  6.54 h
Temperature:     30.06°C

这些工具还公开了您可以在自定义应用程序中使用的 API。
有关更多信息,请参阅https://github.com/jkuri/macstats

于 2016-01-02T21:48:53.107 回答
0

Fanny Widget 工具提供有关您的风扇状况、CPU、GPU 温度等详细信息的详细信息。只需下载开源 mac app 小部件。

https://www.fannywidget.com/

  • 根据我的经验,这只是建议。
于 2021-12-17T05:05:07.893 回答