Skip to content
This repository has been archived by the owner on Oct 12, 2018. It is now read-only.

Commit

Permalink
HWMonitor minor UI tweaks. RadeonSensors added support for Radeon R9 …
Browse files Browse the repository at this point in the history
…series, updated PCI IDs
  • Loading branch information
CozmoNate committed Dec 7, 2013
1 parent d037912 commit 0f25e68
Show file tree
Hide file tree
Showing 5 changed files with 713 additions and 695 deletions.
42 changes: 13 additions & 29 deletions CPUSensors/CPUSensors.cpp
Expand Up @@ -252,9 +252,7 @@ void CPUSensors::readTjmaxFromMSR()
#define ROUND(x) ((x) + 0.5 > int(x) + 1 ? int(x) + 1 : int(x))

float CPUSensors::getSensorValue(FakeSMCSensor *sensor)
{
//IOSimpleLockLock(workloopLock);

{
UInt32 index = sensor->getIndex();

switch (sensor->getGroup()) {
Expand Down Expand Up @@ -312,85 +310,71 @@ float CPUSensors::getSensorValue(FakeSMCSensor *sensor)

}

//IOSimpleLockUnlock(workloopLock);

return 0;
}

IOReturn CPUSensors::woorkloopTimerEvent()
{
if (timerEventsPending) {
//if (++timerEventsMomentum > 5) {
// timerEventsMomentum = 0;
//}


if (bit_get(timerEventsPending, kCPUSensorsCoreThermalSensor)) {
mp_rendezvous_no_intrs(read_cpu_thermal, NULL);
//bit_clear(timerEventsPending, kCPUSensorsCoreThermalSensor);
}

if (bit_get(timerEventsPending, kCPUSensorsPackageThermalSensor)) {
if (bit_get(timerEventsPending, kCPUSensorsPackageThermalSensor)) {
mp_rendezvous_no_intrs(read_cpu_thermal_package, NULL);
//bit_clear(timerEventsPending, kCPUSensorsCoreThermalSensor);
}

if (bit_get(timerEventsPending, kCPUSensorsCoreMultiplierSensor)) {

IOSleep(10);

if (baseMultiplier > 0)
if (baseMultiplier > 0) {
mp_rendezvous_no_intrs(read_cpu_ratio, NULL);
//mp_rendezvous_no_intrs(read_cpu_turbo, NULL);
//else
}

mp_rendezvous_no_intrs(read_cpu_state, NULL);
//bit_clear(timerEventsPending, kCPUSensorsCoreMultiplierSensor);
}

if (bit_get(timerEventsPending, kCPUSensorsPackageMultiplierSensor)) {
UInt32 index = 0;

IOSleep(10);

UInt32 index = 0;
if (baseMultiplier > 0)
if (baseMultiplier > 0) {
mp_rendezvous_no_intrs(read_cpu_ratio, NULL);
//mp_rendezvous_no_intrs(read_cpu_turbo, &index);
//else
if (cpu_ratio[index] <= 1.0f)
}

if (cpu_ratio[index] <= 1.0f) {
mp_rendezvous_no_intrs(read_cpu_state, &index);
//bit_clear(timerEventsPending, kCPUSensorsPackageMultiplierSensor);
}
}

if (bit_get(timerEventsPending, kCPUSensorsTotalPowerSensor)) {
UInt8 index = 0;
read_cpu_energy(&index);
//bit_clear(timerEventsPending, kCPUSensorsTotalPowerSensor);
}

if (bit_get(timerEventsPending, kCPUSensorsCoresPowerSensor)) {
UInt8 index = 1;
read_cpu_energy(&index);
//bit_clear(timerEventsPending, kCPUSensorsCoresPowerSensor);
}

if (bit_get(timerEventsPending, kCPUSensorsUncorePowerSensor)) {
UInt8 index = 2;
read_cpu_energy(&index);
//bit_clear(timerEventsPending, kCPUSensorsUncorePowerSensor);
}

if (bit_get(timerEventsPending, kCPUSensorsDramPowerSensor)) {
UInt8 index = 3;
read_cpu_energy(&index);
//bit_clear(timerEventsPending, kCPUSensorsDramPowerSensor);
}

timerEventsPending = 0;
}

timerEventSource->setTimeoutMS(1000);

//IOSimpleLockUnlock(workloopLock);

return kIOReturnSuccess;
}

Expand Down Expand Up @@ -787,7 +771,7 @@ bool CPUSensors::start(IOService *provider)
registerService();

// start timer
timerEventsMomentum = 0;
//timerEventsMomentum = 0;
timerEventSource->setTimeoutMS(500);

return true;
Expand Down
2 changes: 1 addition & 1 deletion CPUSensors/CPUSensors.h
Expand Up @@ -102,7 +102,7 @@ class CPUSensors : public FakeSMCPlugin
float readMultiplier(UInt8 cpu_index);

UInt16 timerEventsPending;
UInt8 timerEventsMomentum;
//UInt8 timerEventsMomentum;
IOReturn woorkloopTimerEvent(void);

virtual FakeSMCSensor *addSensor(const char *key, const char *type, UInt8 size, UInt32 group, UInt32 index, float reference = 0.0f, float gain = 0.0f, float offset = 0.0f);
Expand Down

0 comments on commit 0f25e68

Please sign in to comment.