URN Logo
UNIX Resources » Linux » China Linux Forum » CPU 与 编译器 » 8 » 请问在程序中怎么读取CPU的温度
announcement 声明: 本页内容为中国Linux论坛的内容镜像,文章的版权以及其他所有的相关权利属于中国Linux论坛和相应文章的作者,如果转载,请注明文章来源及相关版权信息。
Resources
China Linux Forum(finished)
Linux Forum(finished)
FreeBSD China(finished)
linuxforum.net
  业界新闻与评论
  自由软件杂谈
  IT 人生
  Linux软件快递
  翻译作坊
  Linux图书与评论
  GNU Emacs/XEmacs
  Linux 中文环境和中文化
  Linux桌面与办公软件
  Linux 多媒体与娱乐版
  自由之窗Mozilla
  笔记本电脑上的Linux
  Gentoo
  Debian 一族
  网络管理技术
  Linux 安装与入门
  WEB服务器和FTP服务器
  域名服务器和邮件服务器
  Linux防火墙和代理服务器应用
  文件及打印服务器
  技术培训与认证
  Linux内核技术
  Linux 嵌入技术
  Linux设备驱动程序
  Linux 集群技术
  LINUX平台数据库
  系统和网络安全
  CPU 与 编译器
  系统计算研究所专栏
  Linux下的GUI软件开发
  C/C++编程版
  PHP 技 术
  Java&jsp技术
  Shell编程技术
  Perl 编 程
  Python 编 程
  XML/Web Service 技术
  永远的Unix
  FreeBSD世界
   
请问在程序中怎么读取CPU的温度
请问在程序中怎么读取CPU的温度 - yulongcn [2005-06-13 22:03 | 16 byte(s)]
 
Re: 请问在程序中怎么读取CPU的温度 - coly [2005-06-16 09:50 | 831 byte(s)]
 
 
Re: 请问在程序中怎么读取CPU的温度 - bx_bird [2005-06-16 09:39 | 218 byte(s)]
 
Re: 请问在程序中怎么读取CPU的温度 - BNN [2005-06-16 08:21 | 390 byte(s)]
 
Subject: 请问在程序中怎么读取CPU的温度
Author: yulongcn    Posted: 2005-06-13 22:03    Length: 16 byte(s)
[Original] [Print] [Top]
rt
谢谢
[Original] [Print] [Top]
Subject: Re: 请问在程序中怎么读取CPU的温度
Author: BNN    Posted: 2005-06-16 08:21    Length: 390 byte(s)
[Original] [Print] [Top]
Usually, for a CPU, there are some performance counters or something like that, with which you can read for profiling purpose.

Please get the vendor's CPU spec and see if there is a chapter related to this part. I only did something like control the CPU power usage and...yet did anything about your mentioend here.

Wish helpful,

BNN
----
天若有情天亦老,人间正道是沧桑。
[Original] [Print] [Top]
Subject: Re: 请问在程序中怎么读取CPU的温度
Author: bx_bird    Posted: 2005-06-16 09:39    Length: 218 byte(s)
[Original] [Print] [Top]
usually there is a sensor chip connect to southbridge by i2c bus which can be read/controlled by your program.
and usually it has a alarm pin connect to southbridge to generate interrupt when thermal overload.
----
黑暗中有无尽的美
[Original] [Print] [Top]
Subject: Re: 请问在程序中怎么读取CPU的温度
Author: coly    Posted: 2005-06-16 09:50    Length: 831 byte(s)
[Original] [Print] [Top]
根本的方法就是通过I2C总线去读取温度传感器的数值,一般来说,是通过硬件监控芯片来访问的,而不是直接读取寄存器。PC上比较常见的硬件监控芯片由W83627等。可以通过映射到南桥的寄存器来访问I2C总线,从这个超级IO芯片中读取对应于CPU温度的传感器数值。
一般来所,读到的数值并不是直接可以用的,要根据对应硬件监控芯片的spec来进行数值的转换运算(例如风扇转速可能要求一个倒数),才能得到最终可以读懂的数值。

好在,已经有很多软件将I2C的通信都封装起来了,可以很方便的使用,这方面你可以看看lmsensor是如何做的。如果你指向针对某一个特定的硬件环境来做的话,那么程序可以写的很简单的。

除此之外,在集成了IPMI规范的BMC芯片的主板上,可以通过IPMI协议来访问对应的硬件健康信息,这种方式中,与硬件相关的细节都被BMC中的程序屏蔽了,因此驱动程序只需要通过与BMC通信的系统接口按照协议读取想要的监控信息就行了,非常的方便。
----
[Original] [Print] [Top]
Subject: Re: 请问在程序中怎么读取CPU的温度
Author: keyinwind    Posted: 2005-06-22 13:22    Length: 55 byte(s)
[Original] [Print] [Top]
楼上的兄弟:
可否告知MSN,想请教些技术问题
[Original] [Print] [Top]
« Previous thread
求C--原代码(lex,yacc编)
CPU 与 编译器
8
Next thread »
问个多线程的问题
     

Copyright © 2007 UNIX Resources Network, All Rights Reserved.      About URN | Privacy & Legal | Help | Contact us
备案序号: 京ICP备05006143    webmaster: webmaster@unixresources.net
This page created on 2008-07-17 03:47:27, cost 0.047269105911255 ms.