-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
4,000 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
来自:https://github.com/jmdyz/CPUTemp.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 2013 | ||
VisualStudioVersion = 12.0.30501.0 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PluginNvidiaGPU", "PluginNvidiaGPU\PluginNvidiaGPU.vcxproj", "{015AA517-695B-4972-8828-69CEF7E607D0}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Win32 = Debug|Win32 | ||
Debug|x64 = Debug|x64 | ||
Release|Win32 = Release|Win32 | ||
Release|x64 = Release|x64 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{015AA517-695B-4972-8828-69CEF7E607D0}.Debug|Win32.ActiveCfg = Debug|Win32 | ||
{015AA517-695B-4972-8828-69CEF7E607D0}.Debug|Win32.Build.0 = Debug|Win32 | ||
{015AA517-695B-4972-8828-69CEF7E607D0}.Debug|x64.ActiveCfg = Debug|x64 | ||
{015AA517-695B-4972-8828-69CEF7E607D0}.Debug|x64.Build.0 = Debug|x64 | ||
{015AA517-695B-4972-8828-69CEF7E607D0}.Release|Win32.ActiveCfg = Release|Win32 | ||
{015AA517-695B-4972-8828-69CEF7E607D0}.Release|Win32.Build.0 = Release|Win32 | ||
{015AA517-695B-4972-8828-69CEF7E607D0}.Release|x64.ActiveCfg = Release|x64 | ||
{015AA517-695B-4972-8828-69CEF7E607D0}.Release|x64.Build.0 = Release|x64 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
#include <windows.h> | ||
#include "CPUTempProxy.h" | ||
|
||
CoreTempProxy::CoreTempProxy(void) | ||
{ | ||
memset(&this->m_pCoreTempData, 0, sizeof(CoreTempSharedDataEx)); | ||
|
||
RuningEn(gDriverPath); | ||
|
||
pdriver = new driver(OLS_DRIVER_ID, gDriverPath); | ||
|
||
_GetCoreCount(); | ||
|
||
_GetTjMax(); | ||
} | ||
|
||
CoreTempProxy::~CoreTempProxy(void) | ||
{ | ||
delete pdriver; | ||
} | ||
|
||
UINT CoreTempProxy::GetCoreLoad(int _index) const | ||
{ | ||
return this->m_pCoreTempData.uiLoad[_index]; | ||
} | ||
|
||
UINT CoreTempProxy::GetTjMax() const | ||
{ | ||
return this->m_pCoreTempData.uiTjMax; | ||
} | ||
|
||
UINT CoreTempProxy::GetCoreCount() const | ||
{ | ||
return this->m_pCoreTempData.uiCoreCnt; | ||
} | ||
|
||
UINT CoreTempProxy::GetCPUCount() const | ||
{ | ||
return this->m_pCoreTempData.uiCPUCnt; | ||
} | ||
|
||
UINT CoreTempProxy::GetTemp(int _index) const | ||
{ | ||
return this->m_pCoreTempData.uiTemp[_index]; | ||
} | ||
|
||
float CoreTempProxy::GetVID() const | ||
{ | ||
return this->m_pCoreTempData.fVID; | ||
} | ||
|
||
float CoreTempProxy::GetCPUSpeed() const | ||
{ | ||
return this->m_pCoreTempData.fCPUSpeed; | ||
} | ||
|
||
float CoreTempProxy::GetFSBSpeed() const | ||
{ | ||
return this->m_pCoreTempData.fFSBSpeed; | ||
} | ||
|
||
float CoreTempProxy::GetMultiplier() const | ||
{ | ||
return this->m_pCoreTempData.fMultiplier; | ||
} | ||
|
||
LPCSTR CoreTempProxy::GetCPUName() const | ||
{ | ||
return this->m_pCoreTempData.sCPUName; | ||
} | ||
|
||
bool CoreTempProxy::IsFahrenheit() const | ||
{ | ||
return this->m_pCoreTempData.ucFahrenheit != 0; | ||
} | ||
|
||
bool CoreTempProxy::IsDistanceToTjMax() const | ||
{ | ||
return this->m_pCoreTempData.ucDeltaToTjMax != 0; | ||
} | ||
|
||
bool CoreTempProxy::IsTdpSupported() const | ||
{ | ||
return this->m_pCoreTempData.ucTdpSupported != 0; | ||
} | ||
|
||
bool CoreTempProxy::IsPowerSupported() const | ||
{ | ||
return this->m_pCoreTempData.ucPowerSupported != 0; | ||
} | ||
|
||
UINT CoreTempProxy::GetStructureVersion() const | ||
{ | ||
return this->m_pCoreTempData.uiStructVersion; | ||
} | ||
|
||
UINT CoreTempProxy::GetTdp(int _index) const | ||
{ | ||
return this->m_pCoreTempData.uiTdp[_index]; | ||
} | ||
|
||
float CoreTempProxy::GetPower(int _index) const | ||
{ | ||
return this->m_pCoreTempData.fPower[_index]; | ||
} | ||
|
||
float CoreTempProxy::GetMultiplier(int _index) const | ||
{ | ||
return this->m_pCoreTempData.fMultipliers[_index]; | ||
} | ||
|
||
const CoreTempSharedDataEx &CoreTempProxy::GetDataStruct() const | ||
{ | ||
return this->m_pCoreTempData; | ||
} | ||
|
||
bool CoreTempProxy::GetData() | ||
{ | ||
return this->m_SharedMem.ReadSharedMem(&this->m_pCoreTempData); | ||
} | ||
|
||
void CoreTempProxy::_GetCoreCount() | ||
{ | ||
SYSTEM_INFO info; | ||
GetSystemInfo(&info); | ||
m_pCoreTempData.uiCoreCnt=info.dwNumberOfProcessors; | ||
} | ||
|
||
void CoreTempProxy::_GetTjMax() | ||
{ | ||
DWORD eax = 0, edx = 0; | ||
pdriver->Rdmsr(0x1A2, &eax, &edx); | ||
m_pCoreTempData.uiTjMax = (eax & 0xff0000) >> 16; | ||
} | ||
|
||
void CoreTempProxy::_GetTemp(int _index) | ||
{ | ||
DWORD eax = 0, edx = 0; | ||
pdriver->RdmsrTx(0x19C, &eax, &edx, _index); | ||
m_pCoreTempData.uiTemp[_index] = m_pCoreTempData.uiTjMax - ((eax & 0x7f0000) >> 16); | ||
} | ||
|
||
LPCWSTR CoreTempProxy::GetErrorMessage() | ||
{ | ||
DWORD lastError; | ||
|
||
lastError = ::GetLastError(); | ||
if ((lastError & UNKNOWN_EXCEPTION) > 0) | ||
{ | ||
wcscpy_s(this->m_ErrorMessage, L"Unknown error occured while copying shared memory."); | ||
} | ||
else | ||
{ | ||
::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, lastError, 0, this->m_ErrorMessage, 99, NULL); | ||
} | ||
|
||
return this->m_ErrorMessage; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#pragma once | ||
#include "SharedMem.h" | ||
#include "driver.h" | ||
#include "../../Library/Export.h" | ||
|
||
#define UNKNOWN_EXCEPTION 0x20000000 | ||
|
||
class CoreTempProxy | ||
{ | ||
public: | ||
CoreTempProxy(void); | ||
virtual ~CoreTempProxy(void); | ||
|
||
UINT GetCoreLoad(int Index) const; | ||
UINT GetTjMax() const; | ||
UINT GetCoreCount() const; | ||
UINT GetCPUCount() const; | ||
UINT GetTemp(int Index) const; | ||
float GetVID() const; | ||
float GetCPUSpeed() const; | ||
float GetFSBSpeed() const; | ||
float GetMultiplier() const; | ||
LPCSTR GetCPUName() const; | ||
bool IsFahrenheit() const; | ||
bool IsDistanceToTjMax() const; | ||
bool IsTdpSupported() const; | ||
bool IsPowerSupported() const; | ||
UINT GetStructureVersion() const; | ||
UINT GetTdp(int Index) const; | ||
float GetPower(int Index) const; | ||
float GetMultiplier(int Index) const; | ||
|
||
const CoreTempSharedDataEx &GetDataStruct() const; | ||
|
||
bool GetData(); | ||
DWORD GetDllError() const { return GetLastError(); } | ||
LPCWSTR GetErrorMessage(); | ||
|
||
void _GetCoreCount(); | ||
void _GetTjMax(); | ||
void _GetTemp(int _index); | ||
private: | ||
CSharedMemClient m_SharedMem; | ||
CoreTempSharedDataEx m_pCoreTempData; | ||
WCHAR m_ErrorMessage[100]; | ||
|
||
TCHAR gDriverPath[MAX_PATH]; | ||
driver* pdriver; | ||
}; |
Binary file not shown.
Oops, something went wrong.