Autor Beitrag
El Presidente
Hält's aus hier
Beiträge: 9



BeitragVerfasst: Mo 13.08.07 19:15 
Hallo!

I am asking if anyone knows where can i get Intel Core Temperature code i have searched forums but i can't find it. :(


Thanks in advance!


Zuletzt bearbeitet von El Presidente am Sa 10.11.07 12:20, insgesamt 1-mal bearbeitet
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Di 14.08.07 10:00 
Do you look for sourcecode or simply a tool that reads out that information?
For the last possibility have a look here.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Di 14.08.07 10:05 
Via Google Codesearch I've found the following source code:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
sub coretemp_detect
{
  my $probecpu;
  foreach $probecpu (@cpu) {
    if ($probecpu->{'vendor_id'} eq 'GenuineIntel' &&
        $probecpu->{'cpu family'} == 6 &&
        ($probecpu->{'model'} == 14 ||
         $probecpu->{'model'} == 15)) {
      return 9;
    }
  }
  return;
}

Have a look at:
google.com/codesearc...ct/sensors-detect#a0

Press CTRL and F, type 'coretemp' and switch by pressing Return through the search results. One of them is the code above.
This is Perl. I'm not an expert in Perl, so I can't do anything more. ;)
I think you have to search for a Perl forum to get some more help. :(

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot


Zuletzt bearbeitet von Marco D. am Di 14.08.07 11:04, insgesamt 1-mal bearbeitet
Timosch
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1314

Debian Squeeze, Win 7 Prof.
D7 Pers
BeitragVerfasst: Di 14.08.07 10:47 
user profile iconMarco D. hat folgendes geschrieben:
Via Google Codesearch I've found the following source code:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
sub coretemp_detect
{
  my $probecpu;
  foreach $probecpu (@cpu) {
    if ($probecpu->{'vendor_id'} eq 'GenuineIntel' &&
        $probecpu->{'cpu family'} == 6 &&
        ($probecpu->{'model'} == 14 ||
         $probecpu->{'model'} == 15)) {
      return 9;
    }
  }
  return;
}

Have a look at:
google.com/codesearc...ct/sensors-detect#a0

Press CTRL and F, type 'coretemp' and switch by pressing Return through the search results. One of them is the code above.
This is Perl. I'm not an expert in Perl, so I can't do anything more. ;)
I think you have to search for a Perl forum to get some more help. :(


I'm not an expert in Perl either, but I think this piece of code just queries the data from an array, but the array needs to be filled with the temperature etc. before, so this won't help you much.
Try the WMI-Library.

_________________
If liberty means anything at all, it means the right to tell people what they do not want to hear. - George Orwell
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Di 14.08.07 11:04 
Maybe we have to find where the array is filled with the data.
Don't know if this is helpful but the array is filled in this subroutine:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
# @cpu is a list of reference to hashes, one hash per CPU.
# Each entry has the following keys: vendor_id, cpu family, model,
# model name and stepping, directly taken from /proc/cpuinfo.
use vars qw(@cpu);

sub initialize_cpu_list
{
  open(local *INPUTFILE, "/proc/cpuinfo") or die "Can't access /proc/cpuinfo!";
  local $_;
  my %entry;
  while (<INPUTFILE>) {
    if (m/^processor\s*:\s*(\d+)/) {
      push @cpu, \%entry if scalar keys(%entry); # Previous entry
      %entry = (); # New entry
      next;
    }
    if (m/^(vendor_id|cpu family|model|model name|stepping)\s*:\s*(.+)$/) {
      my $k = $1;
      my $v = $2;
      $v =~ s/\s+/ /g;  # Merge multiple spaces
      $v =~ s/ $//;  # Trim trailing space
      $entry{$k} = $v;
      next;
    }
  }
  push @cpu, \%entry if scalar keys(%entry); # Last entry
  close INPUTFILE;
}

I can't do anything more now...

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Timosch
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1314

Debian Squeeze, Win 7 Prof.
D7 Pers
BeitragVerfasst: Di 14.08.07 11:18 
user profile iconMarco D. hat folgendes geschrieben:
Maybe we have to find where the array is filled with the data.
Don't know if this is helpful but the array is filled in this subroutine:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
# @cpu is a list of reference to hashes, one hash per CPU.
# Each entry has the following keys: vendor_id, cpu family, model,
# model name and stepping, directly taken from /proc/cpuinfo.
use vars qw(@cpu);

sub initialize_cpu_list
{
  open(local *INPUTFILE, "/proc/cpuinfo") or die "Can't access /proc/cpuinfo!";
  local $_;
  my %entry;
  while (<INPUTFILE>) {
    if (m/^processor\s*:\s*(\d+)/) {
      push @cpu, \%entry if scalar keys(%entry); # Previous entry
      %entry = (); # New entry
      next;
    }
    if (m/^(vendor_id|cpu family|model|model name|stepping)\s*:\s*(.+)$/) {
      my $k = $1;
      my $v = $2;
      $v =~ s/\s+/ /g;  # Merge multiple spaces
      $v =~ s/ $//;  # Trim trailing space
      $entry{$k} = $v;
      next;
    }
  }
  push @cpu, \%entry if scalar keys(%entry); # Last entry
  close INPUTFILE;
}

I can't do anything more now...


The fact that the data is read from /proc/cpuinfo tells us that it's a Linux source code and won't work with Windows.

_________________
If liberty means anything at all, it means the right to tell people what they do not want to hear. - George Orwell
El Presidente Threadstarter
Hält's aus hier
Beiträge: 9



BeitragVerfasst: Di 14.08.07 11:55 
Danko Leute!


You should take a look at this

delphipraxis.net/top...core2duotemppas.html

---

Hallo!


I found these information..

Zitat:
13.5.5.2 Reading the Digital Sensor
Unlike traditional analog thermal devices, the output of the digital thermal sensor is
a temperature relative to the maximum supported operating temperature of the
processor. Tj(Max).
Temperature measurements returned by digital thermal sensors are always at or
below Tj(Max). Critical temperature conditions are detected using the “Critical
Temperature Status” bit. When this bit is set, the processor is operating at a critical
temperature and immediate shutdown of the system should occur. Once the “Critical
Temperature Status” bit is set, reliable operation is not guaranteed.
See Figure 13-9 for the layout of IA32_THERM_STATUS MSR. Bit fields include:
• Thermal Status (bit 0, RO) — This bit indicates whether the digital thermal
sensor high-temperature output signal (PROCHOT#) is currently active. Bit 0 = 1
indicates the feature is active. This bit may not be written by software; it reflects
the state of the digital thermal sensor.
• Thermal Status Log (bit 1, R/WC0) — This is a sticky bit that indicates the
history of the thermal sensor high temperature output signal (PROCHOT#).
Bit 1 = 1 if PROCHOT# has been asserted since a previous RESET or the last time
software cleared the bit. Software may clear this bit by writing a zero.
• PROCHOT# or FORCEPR# Event (bit 2, RO) — Indicates whether PROCHOT#
or FORCEPR# is being asserted by another agent on the platform.
• PROCHOT# or FORCEPR# Log (bit 3, R/WC0) — Sticky bit that indicates
whether PROCHOT# or FORCEPR# has been asserted by another agent on the


And this code :D
ausblenden volle Höhe C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
#include <float.h> 
#include <stdio.h> 
#include <windows.h> 

#include "C2DTemp.h" 
#include "RivaTunerExports.h" 
#include "MonitoringSourceDesc.h" 

HINSTANCE g_hModule = NULL; 
HMODULE g_hHost = NULL; 

READ_MSR_PROC g_pReadMSR = NULL; 

DWORD g_dwCPU = 0
BOOL g_bHasDTS = FALSE; 
FLOAT g_fTjmax = 100.0f

const char * const szDim = "°C"
const char * const szDesc = "CPU temperature as reported by on-die Digital Thermal Sensor"
const char * const szGroup = "CPU"

BOOL DetectCPUFeatures(void

const char ven_intel[12] = {'G','e','n','u','i','n','e','I','n','t','e','l'}; 
char vendor[12]; 
DWORD last_fn = 0, fn6_eax = 0

memset(vendor, 012); 

// try to execute CPUID instruction 
__try { 
__asm { 
xor eax, eax 
xor ebx, ebx 
xor ecx, ecx 
xor edx, edx 
cpuid 
mov dword ptr [last_fn], eax 
mov dword ptr [vendor], ebx 
mov dword ptr [vendor + 4], edx 
mov dword ptr [vendor + 8], ecx 


__except (GetExceptionCode() == STATUS_ILLEGAL_INSTRUCTION) { 
return FALSE; 


// Is it GenuineIntel CPU? 
if (strncmp(vendor, ven_intel, 12) != 0) { 
return FALSE; 


// Does it support Digital Thermal Sensor and Power Management CPUID leaf? 
if (last_fn < 6) { 
return FALSE; 


__asm { 
mov eax, 6 
cpuid 
mov dword ptr [fn6_eax], eax 


// Is Digital Thermal Sensor feature supported? 
if ((fn6_eax & 0x1) == 0) { 
return FALSE; 


return TRUE; 


BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) 

UNREFERENCED_PARAMETER(lpReserved); 

if (dwReason == DLL_PROCESS_ATTACH) { 
g_hModule = hInstance; 
g_bHasDTS = DetectCPUFeatures(); 


return TRUE; 


C2DTEMP_API DWORD GetSourcesNum(void

SYSTEM_INFO si; 

GetSystemInfo(&si); 

g_dwCPU = si.dwNumberOfProcessors; 

return g_dwCPU; 


C2DTEMP_API BOOL GetSourceDesc(DWORD dwIndex, LPMONITORING_SOURCE_DESC pDesc) 

DWORD hi, lo; 

if (g_pReadMSR == NULL) { 
g_hHost = GetModuleHandle(NULL); 

if (g_hHost == NULL) { 
return FALSE; 


g_pReadMSR = (READ_MSR_PROC)GetProcAddress(g_hHost, "ReadMSR"); 

if (g_pReadMSR == NULL) { 
return FALSE; 


if (!g_bHasDTS) { 
return FALSE; 
else { 
// Try to detect Tjunction 
if (!g_pReadMSR(0xEE, &hi, &lo)) { 
return FALSE; 

if (lo & 0x40000000) { 
g_fTjmax = 85.0f




sprintf(pDesc->szName, "CPU%ld temperature", dwIndex); 
strcpy(pDesc->szDim , szDim); 
strcpy(pDesc->szDesc , szDesc); 

if (pDesc->dwVersion >= 0x00010002) { 
strcpy(pDesc->szGroup, szGroup); 


pDesc->fltMaxLimit = 100.0f
pDesc->fltMinLimit = 0.0f
pDesc->fltGridDim = 10.0f

return TRUE; 


C2DTEMP_API FLOAT GetSourceData(DWORD dwIndex) 

static FLOAT val[32] = { FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX, 
FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX, 
FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX, 
FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX, 
FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX, 
FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX, 
FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX, 
FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX 
}; 

DWORD_PTR dwMask, dwProcessAffinityMask, dwSystemAffinityMask; 
DWORD hi, lo; 

// Is DTS supported by this CPU? 
if (!g_bHasDTS) { 
return FLT_MAX; 


// NOTE: This should be done by RivaTuner before calling plugins 
// Will be removed when Alexey implements it internally 

// Get current process and system affinity mask 
if (!GetProcessAffinityMask(GetCurrentProcess(), &dwProcessAffinityMask, &dwSystemAffinityMask)) { 
return FLT_MAX; 


// Temporarily enable execution on all the CPUs in the system 
if (!SetProcessAffinityMask(GetCurrentProcess(), dwSystemAffinityMask)) { 
return FLT_MAX; 


dwMask = 1 << dwIndex; 

// Move the thread to the proper core 
if (!SetThreadAffinityMask(GetCurrentThread(), dwMask)) { 
return FLT_MAX; 


// Read IA32_THERM_STATUS MSR 
if (!g_pReadMSR(0x19C, &hi, &lo)) { 
return FLT_MAX; 


// Is reading valid? 
// If not, just return previous value 
if ((lo & 0x80000000) == 0) { 
return val[dwIndex]; 


val[dwIndex] = g_fTjmax - (FLOAT)((lo >> 16) & 0x7F); 

return val[dwIndex]; 
}


Moderiert von user profile iconNarses: Merged postings