Awards:
Core Temp Plug-in Software Development Kit (SDK)
Introduction:
Core Temp’s version 0.99 introduced a Shared Memory interface, enabling third-party applications to access a shared memory block generated by Core Temp. This allowed them to access the information provided by Core Temp.
With the release of version 1.0, Core Temp has taken a significant leap forward by introducing a comprehensive plugin platform. This platform enables Core Temp to support plugins in virtually any programming language. Notably, it even accommodates .NET Framework-based plugins with a straightforward and efficient implementation process. Thanks to the simplicity and effectiveness of Core Temp’s plugin system, a functional plugin can be created in seconds.
Download SDK
Implementation:
Currently the data structure used by both the shared memory interface and the plug-in platform is the same. It is implemented as follows (C/C++):
typedef struct core_temp_shared_data_ex
{
// Original structure (CoreTempSharedData)
unsigned int uiLoad[256];
unsigned int uiTjMax[128];
unsigned int uiCoreCnt;
unsigned int uiCPUCnt;
float fTemp[256];
float fVID;
float fCPUSpeed;
float fFSBSpeed;
float fMultiplier;
char sCPUName[100];
unsigned char ucFahrenheit;
unsigned char ucDeltaToTjMax;
// uiStructVersion = 2
unsigned char ucTdpSupported;
unsigned char ucPowerSupported;
unsigned int uiStructVersion;
unsigned int uiTdp[128];
float fPower[128];
float fMultipliers[256];
} CoreTempSharedDataEx, *LPCoreTempSharedDataEx, **PPCoreTempSharedDataEx;
An unsigned int denotes a 32-bit unsigned integer
while an unsigned char represents an 8-bit (1 byte) value
Float signifies a 32-bit floating point value.
For structure member alignment, a ‘4 Byte’ alignment is recommended.
The variable uiStructVersion denotes the version of the CoreTempSharedDataEx structure. The current version is 2, and future versions will only extend this structure to maintain backward compatibility. It’s essential for plugins and shared memory clients to support the old interface as well, with samples provided in the SDK.
Variables ucFahrenheit, ucDeltaToTjMax, ucTdpSupported, and ucPowerSupported indicate boolean values, where 0 signifies false and 1 signifies true. If ucFahrenheit is true, the temperature is reported in Fahrenheit. If ucDeltaToTjMax is true, the reported temperature represents the distance from TjMax. If ucTdpSupported is true, the processor TDP information in the uiTdp array is valid. Similarly, if ucPowerSupported is true, the processor power consumption information in the fPower array is valid.
The life-cycle of a plugin:
The plugin follows a coherent and logical life-cycle, with functions called in a specific order to facilitate starting, stopping, and receiving updates. Developers can refer to the documentation in the SDK for detailed instructions on developing and implementing a plugin.
1. Start: This function is invoked first. It’s where a plugin initializes itself and, if applicable, displays its user interface on the screen.
2. UpdateEx: After the Start function is invoked, UpdateEx receives initial data from Core Temp. Subsequently, UpdateEx is called with every refresh Core Temp makes.
3. Configure: This function can only be called once Start has been invoked. It allows for configuration settings to be adjusted.
4. Stop: Invoked when the plugin is stopped either from the plugin manager or when Core Temp is shutting down.
5. Remove: If the user chooses to remove the plugin, Remove is invoked only after a Stop invocation to allow the plugin to release resources. This function handles cleanup before the plugin is removed.
Download SDK
Shared memory interface:
Core Temp’s shared area is named: “CoreTempMappingObjectEx”.
Older versions of Core Temp created a shared area named “CoreTempMappingObject”, the original structure layout can be seen at the top of the page.
C++ Dynamic Link Library for the shared memory interface:
This DLL was written in C++, and it can be easily used with most programming languages.
Version 1.2 adds support for static linking of the DLL in Borland environments (32 bit only).
There is only a single function, here is the internal function declaration:
bool __declspec(dllimport) fnGetCoreTempInfo(CoreTempSharedDataEx *&pData);
You can declare it in your program in the following manner:
typedef bool (*fnGetCoreTempInfo)(CoreTempSharedDataEx *&pData);
fnGetCoreTempInfo GetCoreTempInfo;
For compatibility with some programming languages a function was added.
It uses Win32 API calling convention and is declared as follows:
bool WINAPI fnGetCoreTempInfoAlt(CoreTempSharedDataEx *pData);
typedef bool (*fnGetCoreTempInfoAlt)(CoreTempSharedDataEx *pData);
fnGetCoreTempInfoAlt GetCoreTempInfo;
Version 1.2 of the DLL adds the option for better object oriented approach, although you can take advantage of it only in case you statically link the DLL to your project and include the header file provided in the archive.
CoreTempProxy *proxy = new CoreTempProxy();
Usage:
- Declare a pointer to CoreTempSharedDataEx structure and allocate it.
- It is also recommended to fill the allocated memory with NULL to avoid possible problems.
- Call the function using the pointer to CoreTempSharedDataEx structure as an argument.
- The function will fill the structure if the shared memory was successfully read.
- The function returns ‘true’ if succeeded and ‘false’ if it failed. You can use GetLastError() in case the function fails.
- In case the function fails due to an exception GetLastError() returns UNKNOWN_EXCEPTION (0x20000000)
- Check uiStructVersion to make sure what information is valid, if uiStructVersion < 2 then TDP, power and per-core multiplier information will not be valid.
Download SDK
.NET Framework 2.0 Dynamic Link Library for the shared memory interface:
This DLL was written in C# with the project set to .NET Framework 2.0.
The namespace is “GetCoreTempInfoNET”.
Class name is “CoreTempInfo”.
Usage:
- Create an instance of “CoreTempInfo” class.
- It is a good idea to sign up for the ReportError event, fired whenever an error occurs, containing an error code and the error message.
- The function returns ‘true’ if succeeded and ‘false’ if it failed. You can use GetLastError property in case the function fails. The return value is of enum type “ErrorCodes”.
- In case the function fails due to an exception GetLastError returns Data_Retrieve_Failed (0x0).
- You can use the GetErrorMessage() function to retrieve a string containing a textual error message.
- Check uiStructVersion to make sure what information is valid, if uiStructVersion < 2 then TDP, power and per-core multiplier information will not be valid.