Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works
Anything · Lazarus or Delphi
Random projectRandom project

CoreTemp-Reader

An example of how to determine CPU core temperatures in Delphi using the CoreTemp program.

View on GitHub

Member rating

No ratings yet.

Sign in to rate this project.

README

CoreTemp-Reader

Compiler 10 Seattle 10 1 Berlin 10 2 Tokyo 10 3 Rio 10 4 Sydney 11 Alexandria 12 Athens
Components None

Core Temp memory reader for Delphi is a shared memory interface library. This library provides an easy access to the Core Temp's shared memory and allows reading data from it. There is a sample demo project showing how to use the interface library.

CoreTemp Reader requires the CoreTemp program to capture and analyze data from system memory. The program can be started and stopped either manually or automatically.

Delphi Source

Download Source : https://74.cz/download/GetCoreTempInfoDelphi.zip
Download Console Project : https://74.cz/download/SMCoreTempDelphiReader.zip

Code Example:

pascal

program SMCoreTempDelphiReader;

{$APPTYPE CONSOLE}

uses
  Windows,
  SysUtils,
  GetCoreTempInfoDelphi in 'GetCoreTempInfoDelphi.pas';

var
  Data: CORE_TEMP_SHARED_DATA;
  CPU, Core, Index: Cardinal;
  Degree: Char;
  Temp: Single;

function StringToOem(const Str: string): AnsiString;
begin
  Result := AnsiString(Str);
  if Length(Result) > 0 then
    CharToOemA(PAnsiChar(Result), PAnsiChar(Result));
end;

begin
  try
    Writeln('Core Temp shared memory reader');
    if fnGetCoreTempInfo(Data) then
    begin
      Writeln('Processor  : ' + Data.sCPUName);
      Writeln('Core(s)    : ' + IntToStr(Data.uiCoreCnt));
      Writeln('CPU(s)     : ' + IntToStr(Data.uiCPUCnt));
      Writeln('CPU speed  : ' + FloatToStrF(Data.fCPUSpeed, ffFixed, 7, 0)
        + ' MHz');
      Writeln('FSB speed  : ' + FloatToStrF(Data.fFSBSpeed, ffFixed, 7, 0)
        + ' MHz');
      Writeln('Multiplier : ' + FloatToStrF(Data.fMultipier, ffFixed, 7, 1));
      Writeln('VID        : ' + FloatToStrF(Data.fVID, ffFixed, 7, 2) + ' V');
      if Data.ucFahrenheit then
        Degree := 'F'
      else
        Degree := 'C';
      for CPU := 0 to Data.uiCPUCnt - 1 do
      begin
        for Core := 0 to Data.uiCoreCnt - 1 do
        begin
          Index := (CPU * Data.uiCoreCnt) + Core;
          if Data.ucDeltaToTjMax then
            Temp := Data.uiTjMax[CPU] - Data.fTemp[Index]
          else
            Temp := Data.fTemp[Index];
          Write('CPU #' + IntToStr(CPU) + ', Core #' + IntToStr(Core) + ':  ');
          Write('Temperature = ' + FloatToStrF(Temp, ffFixed, 7, 0) + ' ' +
            Degree + '  ');
          Writeln('Load = ' + IntToStr(Data.uiLoad[Index]) + ' %');
        end;
      end;
    end
    else
    begin
      Writeln('Error: Core Temp''s shared memory could not be read');
      Writeln('Reason: ' + StringToOem(SysErrorMessage(GetLastError)));
    end;
  except
    on E: Exception do
      Writeln(E.Classname, ': ', E.Message);
  end;

end.

CoreTemp

Core Temp is a compact, no fuss, small footprint, yet powerful program to monitor processor temperature and other vital information.

What makes Core Temp unique is the way it works. It is capable of displaying a temperature of each individual core of every processor in your system!

You can see temperature fluctuations in real time with varying workloads. Core Temp is also motherboard agnostic.

Download latest Version: https://www.alcpu.com/CoreTemp/Core-Temp-setup-v1.20.1.150.exe

Core Temp makes it easy for you to monitor the temperature of any modern x86 based processor. The program supports processors from all three major manufacturers; Intel, AMD and VIA.

Intel processors starting with the "Core" series all the way up to the newest Core i7, including all the derivatives. AMD processors starting with the first Athlon64 and Opteron processor series, all Phenom and AMD's new APU are supported. VIA processors starting with the C7 generation of CPUs, including all the derivatives based on the C7 architecture. All of the Nano based processors are supported as well.

The temperature readings are very accurate as the data is collected directly from a Digital Thermal Sensor (or DTS) which is located in each individual processing core*, near the hottest part. This sensor is digital, which means it doesn't rely on an external circuit located on the motherboard to report temperature, its value is stored in a special register in the processor so that software can access and read it. This eliminates any inaccuracies that can be introduced by external motherboard circuits and sensors.

This is how the program works:

Intel defines a certain Tjunction temperature for the processor. This value is usually in the range between 85°C and 105°C. In the later generation of processors, starting with Nehalem, the exact Tjunction Max value is available for software to read in an MSR (short for Model Specific Register). A different MSR contains the temperature data. The data is represented as a Delta in °C between current temperature and Tjunction.

So the actual temperature is calculated like this 'Core Temp = Tjunction - Delta'

The size of the data field is 7 bits. This means a Delta of 0 - 127°C can be reported in theory. In fact the reported temperature can rarely go below 0°C and in some cases (Core 2 - 45nm series) temperatures below 30° or even 40°C are not reported.

Supported Processors: