mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-08-29 05:18:14 +00:00
Fixed a NullReferenceException in the AMD17CPU.Update method.
This commit is contained in:
parent
f659204b5c
commit
59bd626aef
@ -111,10 +111,9 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
|||||||
"CPU Package", 0, SensorType.Power, this, settings);
|
"CPU Package", 0, SensorType.Power, this, settings);
|
||||||
ActivateSensor(packagePowerSensor);
|
ActivateSensor(packagePowerSensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
coresPowerSensor = new Sensor("CPU Cores", 1, SensorType.Power, this,
|
|
||||||
settings);
|
|
||||||
}
|
}
|
||||||
|
coresPowerSensor = new Sensor("CPU Cores", 1, SensorType.Power, this,
|
||||||
|
settings);
|
||||||
|
|
||||||
busClock = new Sensor("Bus Speed", 0, SensorType.Clock, this, settings);
|
busClock = new Sensor("Bus Speed", 0, SensorType.Clock, this, settings);
|
||||||
timeStampCounterMultiplier = GetTimeStampCounterMultiplier();
|
timeStampCounterMultiplier = GetTimeStampCounterMultiplier();
|
||||||
@ -236,8 +235,9 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
|||||||
ActivateSensor(ccdAvgTemperature);
|
ActivateSensor(ccdAvgTemperature);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ring0.Rdmsr(MSR_PKG_ENERGY_STAT, out uint energyConsumed, out _)) {
|
if (energyUnitMultiplier != 0 &&
|
||||||
|
Ring0.Rdmsr(MSR_PKG_ENERGY_STAT, out uint energyConsumed, out _))
|
||||||
|
{
|
||||||
DateTime time = DateTime.UtcNow;
|
DateTime time = DateTime.UtcNow;
|
||||||
float deltaTime = (float)(time - lastEnergyTime).TotalSeconds;
|
float deltaTime = (float)(time - lastEnergyTime).TotalSeconds;
|
||||||
if (deltaTime > 0.01) {
|
if (deltaTime > 0.01) {
|
||||||
@ -318,14 +318,16 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
|||||||
|
|
||||||
multiplier = GetMultiplier();
|
multiplier = GetMultiplier();
|
||||||
ThreadAffinity.Set(mask);
|
ThreadAffinity.Set(mask);
|
||||||
|
|
||||||
float deltaTime = (float)(energyTime - lastEnergyTime).TotalSeconds;
|
if (cpu.energyUnitMultiplier != 0) {
|
||||||
if (deltaTime > 0.01) {
|
float deltaTime = (float)(energyTime - lastEnergyTime).TotalSeconds;
|
||||||
power = cpu.energyUnitMultiplier *
|
if (deltaTime > 0.01) {
|
||||||
unchecked(energyConsumed - lastEnergyConsumed) / deltaTime;
|
power = cpu.energyUnitMultiplier *
|
||||||
powerSensor.Value = power;
|
unchecked(energyConsumed - lastEnergyConsumed) / deltaTime;
|
||||||
lastEnergyTime = energyTime;
|
powerSensor.Value = power;
|
||||||
lastEnergyConsumed = energyConsumed;
|
lastEnergyTime = energyTime;
|
||||||
|
lastEnergyConsumed = energyConsumed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (multiplier.HasValue) {
|
if (multiplier.HasValue) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user