- add temperature sensors for high/low/critical limits
- change thermal sensor index to 0
- adjust sensor indices accordingly

Storage:
- add Free Space sensor
- add Total Space sensor
- change temperature sensors indices to start from 0
- remove temperature sensor 1 as the non numbered sensor is the same
This commit is contained in:
Blacktempel
2026-01-06 23:23:59 +01:00
committed by GitHub
parent 2871d753af
commit a673f60d0b
3 changed files with 82 additions and 65 deletions
@@ -31,7 +31,7 @@ internal sealed class DimmMemory : Hardware
case SPDMemoryType.SPD_DDR5_SDRAM:
case SPDMemoryType.SPD_LPDDR5_SDRAM:
_thermalSensor = new SpdThermalSensor($"DIMM #{accessor.Index}",
accessor.Index,
0,
SensorType.Temperature,
this,
settings,
@@ -74,30 +74,33 @@ internal sealed class DimmMemory : Hardware
if (hasThermalSensor)
{
//Temperature Resolution (fixed value)
AddSensor("Temperature Sensor Resolution", 0, false, SensorType.Temperature, accessor.TemperatureResolution);
AddSensor("Temperature Sensor Resolution", 1, false, SensorType.Temperature, accessor.TemperatureResolution);
AddSensor("Thermal Sensor Low Limit", 2, false, SensorType.Temperature, accessor.ThermalSensorLowLimit);
AddSensor("Thermal Sensor High Limit", 3, false, SensorType.Temperature, accessor.ThermalSensorHighLimit);
AddSensor("Thermal Sensor Critical Limit", 4, false, SensorType.Temperature, accessor.ThermalSensorCriticalLimit);
}
//Timings
AddSensor("tCKAVGmin (Minimum Cycle Time)", 1, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumCycleTime);
AddSensor("tCKAVGmax (Maximum Cycle Time)", 2, false, SensorType.Timing, (float)accessor.SDRAMTimings.MaximumCycleTime);
AddSensor("tAA (CAS Latency Time)", 3, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumCASLatencyTime);
AddSensor("tRCD (RAS to CAS Delay Time)", 4, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumRASToCASDelayTime);
AddSensor("tRP (Row Precharge Delay Time)", 5, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumRowPrechargeDelayTime);
AddSensor("tRAS (Active to Precharge Delay Time)", 6, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumActiveToPrechargeDelayTime);
AddSensor("tRC (Active to Active/Refresh Delay Time)", 7, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumActiveToActiveRefreshDelayTime);
AddSensor("tRFC1 (Refresh Recovery Delay Time)", 8, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumRefreshRecoveryDelayTime1);
AddSensor("tRFC2 (Refresh Recovery Delay Time)", 9, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumRefreshRecoveryDelayTime2);
AddSensor("tRFC4 (Refresh Recovery Delay Time)", 10, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumRefreshRecoveryDelayTime4);
AddSensor("tFAW (Four Activate Window Time)", 11, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumFourActivateWindowTime);
AddSensor("tRRD_S (Activate to Activate Delay Time)", 12, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumActivateToActivateDelay_DiffGroup);
AddSensor("tRRD_L (Activate to Activate Delay Time)", 13, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumActivateToActivateDelay_SameGroup);
AddSensor("tCCD_L (CAS to CAS Delay Time)", 14, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumCASToCASDelay_SameGroup);
AddSensor("tWR (Write Recovery Time)", 15, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumWriteRecoveryTime);
AddSensor("tWTR_S (Write to Read Time)", 16, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumWriteToReadTime_DiffGroup);
AddSensor("tWTR_L (Write to Read Time)", 17, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumWriteToReadTime_SameGroup);
AddSensor("tCKAVGmin (Minimum Cycle Time)", 20, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumCycleTime);
AddSensor("tCKAVGmax (Maximum Cycle Time)", 21, false, SensorType.Timing, (float)accessor.SDRAMTimings.MaximumCycleTime);
AddSensor("tAA (CAS Latency Time)", 22, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumCASLatencyTime);
AddSensor("tRCD (RAS to CAS Delay Time)", 23, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumRASToCASDelayTime);
AddSensor("tRP (Row Precharge Delay Time)", 24, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumRowPrechargeDelayTime);
AddSensor("tRAS (Active to Precharge Delay Time)", 25, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumActiveToPrechargeDelayTime);
AddSensor("tRC (Active to Active/Refresh Delay Time)", 26, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumActiveToActiveRefreshDelayTime);
AddSensor("tRFC1 (Refresh Recovery Delay Time)", 27, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumRefreshRecoveryDelayTime1);
AddSensor("tRFC2 (Refresh Recovery Delay Time)", 28, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumRefreshRecoveryDelayTime2);
AddSensor("tRFC4 (Refresh Recovery Delay Time)", 29, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumRefreshRecoveryDelayTime4);
AddSensor("tFAW (Four Activate Window Time)", 30, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumFourActivateWindowTime);
AddSensor("tRRD_S (Activate to Activate Delay Time)", 31, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumActivateToActivateDelay_DiffGroup);
AddSensor("tRRD_L (Activate to Activate Delay Time)", 32, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumActivateToActivateDelay_SameGroup);
AddSensor("tCCD_L (CAS to CAS Delay Time)", 33, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumCASToCASDelay_SameGroup);
AddSensor("tWR (Write Recovery Time)", 34, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumWriteRecoveryTime);
AddSensor("tWTR_S (Write to Read Time)", 35, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumWriteToReadTime_DiffGroup);
AddSensor("tWTR_L (Write to Read Time)", 36, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumWriteToReadTime_SameGroup);
//Data
AddSensor("Capacity", 18, false, SensorType.Data, accessor.GetCapacity());
AddSensor("Capacity", 50, false, SensorType.Data, accessor.GetCapacity());
}
private void CreateSensorsDDR5(DDR5Accessor accessor, bool hasThermalSensor)
@@ -105,27 +108,31 @@ internal sealed class DimmMemory : Hardware
if (hasThermalSensor)
{
//Temperature Resolution (fixed value)
AddSensor("Temperature Sensor Resolution", 0, false, SensorType.Temperature, accessor.TemperatureResolution);
AddSensor("Temperature Sensor Resolution", 1, false, SensorType.Temperature, accessor.TemperatureResolution);
AddSensor("Thermal Sensor Low Limit", 2, false, SensorType.Temperature, accessor.ThermalSensorLowLimit);
AddSensor("Thermal Sensor High Limit", 3, false, SensorType.Temperature, accessor.ThermalSensorHighLimit);
AddSensor("Thermal Sensor Critical Low Limit", 4, false, SensorType.Temperature, accessor.ThermalSensorCriticalLowLimit);
AddSensor("Thermal Sensor Critical High Limit", 5, false, SensorType.Temperature, accessor.ThermalSensorCriticalHighLimit);
}
//Timings
AddSensor("tCKAVGmin (Minimum Cycle Time)", 1, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumCycleTime);
AddSensor("tCKAVGmax (Maximum Cycle Time)", 2, false, SensorType.Timing, (float)accessor.SDRAMTimings.MaximumCycleTime);
AddSensor("tAA (CAS Latency Time)", 3, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumCASLatencyTime);
AddSensor("tRCD (RAS to CAS Delay Time)", 4, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumRASToCASDelayTime);
AddSensor("tRP (Row Precharge Delay Time)", 5, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumRowPrechargeDelayTime);
AddSensor("tRAS (Active to Precharge Delay Time)", 6, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumActiveToPrechargeDelayTime);
AddSensor("tRC (Active to Active/Refresh Delay Time)", 7, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumActiveToActiveRefreshDelayTime);
AddSensor("tWR (Write Recovery Time)", 8, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumWriteRecoveryTime);
AddSensor("tRFC1 (Normal Refresh Recovery Time)", 9, false, SensorType.Timing, (float)accessor.SDRAMTimings.NormalRefreshRecoveryTime);
AddSensor("tRFC2 (Fine Granularity Refresh Recovery Time)", 10, false, SensorType.Timing, (float)accessor.SDRAMTimings.FineGranularityRefreshRecoveryTime);
AddSensor("tRFCsb (Same Bank Refresh Recovery Time)", 11, false, SensorType.Timing, (float)accessor.SDRAMTimings.SameBankRefreshRecoveryTime);
AddSensor("tRFC1_dlr (Normal Refresh Recovery Time 3DS)", 12, false, SensorType.Timing, (float)accessor.SDRAMTimings.NormalRefreshRecoveryTime_3DSDifferentLogicalRank);
AddSensor("tRFC2_dlr (Fine Granularity Refresh Recovery Time 3DS)", 13, false, SensorType.Timing, (float)accessor.SDRAMTimings.FineGranularityRefreshRecoveryTime_3DSDifferentLogicalRank);
AddSensor("tRFCsb_dlr (Same Bank Refresh Recovery Time 3DS)", 14, false, SensorType.Timing, (float)accessor.SDRAMTimings.SameBankRefreshRecoveryTime_3DSDifferentLogicalRank);
AddSensor("tCKAVGmin (Minimum Cycle Time)", 20, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumCycleTime);
AddSensor("tCKAVGmax (Maximum Cycle Time)", 21, false, SensorType.Timing, (float)accessor.SDRAMTimings.MaximumCycleTime);
AddSensor("tAA (CAS Latency Time)", 22, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumCASLatencyTime);
AddSensor("tRCD (RAS to CAS Delay Time)", 23, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumRASToCASDelayTime);
AddSensor("tRP (Row Precharge Delay Time)", 24, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumRowPrechargeDelayTime);
AddSensor("tRAS (Active to Precharge Delay Time)", 25, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumActiveToPrechargeDelayTime);
AddSensor("tRC (Active to Active/Refresh Delay Time)", 26, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumActiveToActiveRefreshDelayTime);
AddSensor("tWR (Write Recovery Time)", 27, false, SensorType.Timing, (float)accessor.SDRAMTimings.MinimumWriteRecoveryTime);
AddSensor("tRFC1 (Normal Refresh Recovery Time)", 28, false, SensorType.Timing, (float)accessor.SDRAMTimings.NormalRefreshRecoveryTime);
AddSensor("tRFC2 (Fine Granularity Refresh Recovery Time)", 29, false, SensorType.Timing, (float)accessor.SDRAMTimings.FineGranularityRefreshRecoveryTime);
AddSensor("tRFCsb (Same Bank Refresh Recovery Time)", 30, false, SensorType.Timing, (float)accessor.SDRAMTimings.SameBankRefreshRecoveryTime);
AddSensor("tRFC1_dlr (Normal Refresh Recovery Time 3DS)", 31, false, SensorType.Timing, (float)accessor.SDRAMTimings.NormalRefreshRecoveryTime_3DSDifferentLogicalRank);
AddSensor("tRFC2_dlr (Fine Granularity Refresh Recovery Time 3DS)", 32, false, SensorType.Timing, (float)accessor.SDRAMTimings.FineGranularityRefreshRecoveryTime_3DSDifferentLogicalRank);
AddSensor("tRFCsb_dlr (Same Bank Refresh Recovery Time 3DS)", 33, false, SensorType.Timing, (float)accessor.SDRAMTimings.SameBankRefreshRecoveryTime_3DSDifferentLogicalRank);
//Data
AddSensor("Capacity", 15, false, SensorType.Data, accessor.GetCapacity());
AddSensor("Capacity", 50, false, SensorType.Data, accessor.GetCapacity());
}
private void AddSensor(string name, int index, bool defaultHidden, SensorType sensorType, float value)
@@ -11,7 +11,7 @@ namespace LibreHardwareMonitor.Hardware.Storage;
internal static class SmartAttributeTranslator
{
const int SensorChannelStartIndex = 30;
const int SensorChannelStartIndex = 100;
public static List<SmartAttribute> GetAttributesFor(DiskInfoToolkit.Storage storage)
{
@@ -44,6 +44,7 @@ public sealed class StorageDevice : Hardware, ISmart
private Sensor _sensorDiskWriteActivity;
private Sensor _sensorDiskWriteRate;
private Sensor _usageSensor;
private Sensor _freeSpaceSensor;
public StorageDevice(DiskInfoToolkit.Storage storage, string id, ISettings settings)
: base(storage.Model, new Identifier(id, storage.DriveNumber.ToString(CultureInfo.InvariantCulture)), settings)
@@ -72,8 +73,8 @@ public sealed class StorageDevice : Hardware, ISmart
_lastUpdate = DateTime.UtcNow;
//Toggle usage sensor
ToggleUsageSensor();
//Toggle space sensors
ToggleSpaceSensors();
//Update performance sensors
UpdatePerformanceSensors();
@@ -81,8 +82,8 @@ public sealed class StorageDevice : Hardware, ISmart
//Update storage object
_storage.Update();
//Update usage sensors
UpdateUsageSensor();
//Update space sensors
UpdateSpaceSensors();
//Update attributes
foreach (var attribute in _storage.Smart.SmartAttributes)
@@ -168,45 +169,50 @@ public sealed class StorageDevice : Hardware, ISmart
private void CreateSensors()
{
_usageSensor = new Sensor("Used Space", 0, SensorType.Load, this, _settings);
ToggleUsageSensor();
AddSensor("Temperature", 0, false, SensorType.Temperature, s => s.Smart.Temperature.GetValueOrDefault());
int index = 0;
if (_storage.IsNVMe)
{
//TemperatureSensor1 equals the main temperature sensor; no need to add it again
TryAddTemperatureSensor(1, false, 2, SmartAttributeType.TemperatureSensor2);
TryAddTemperatureSensor(2, false, 3, SmartAttributeType.TemperatureSensor3);
TryAddTemperatureSensor(3, false, 4, SmartAttributeType.TemperatureSensor4);
TryAddTemperatureSensor(4, false, 5, SmartAttributeType.TemperatureSensor5);
TryAddTemperatureSensor(5, false, 6, SmartAttributeType.TemperatureSensor6);
TryAddTemperatureSensor(6, false, 7, SmartAttributeType.TemperatureSensor7);
TryAddTemperatureSensor(7, false, 8, SmartAttributeType.TemperatureSensor8);
AddSensor("Temperature", index++, false, SensorType.Temperature, s => s.Smart.Temperature.GetValueOrDefault());
AddSensor("Temperature warning", 10, false, SensorType.Temperature, s => s.Smart.TemperatureWarning.GetValueOrDefault());
AddSensor("Temperature critical", 11, false, SensorType.Temperature, s => s.Smart.TemperatureCritical.GetValueOrDefault());
}
if (_storage.Smart.Life.HasValue)
{
AddSensor("Life", index++, false, SensorType.Level, s => s.Smart.Life.GetValueOrDefault());
AddSensor("Life", 20, false, SensorType.Level, s => s.Smart.Life.GetValueOrDefault());
}
if (_storage.Smart.HostReads.HasValue)
{
AddSensor("Data read", index++, false, SensorType.Data, s => s.Smart.HostReads.GetValueOrDefault());
AddSensor("Data read", 21, false, SensorType.Data, s => s.Smart.HostReads.GetValueOrDefault());
}
if (_storage.Smart.HostWrites.HasValue)
{
AddSensor("Data written", index++, false, SensorType.Data, s => s.Smart.HostWrites.GetValueOrDefault());
AddSensor("Data written", 22, false, SensorType.Data, s => s.Smart.HostWrites.GetValueOrDefault());
}
AddSensor("Power on count", index++, false, SensorType.Factor, s => s.Smart.PowerOnCount);
AddSensor("Power on hours", index++, false, SensorType.Factor, s => Math.Max(s.Smart.MeasuredPowerOnHours, s.Smart.DetectedPowerOnHours));
AddSensor("Power on count", 23, false, SensorType.Factor, s => s.Smart.PowerOnCount);
AddSensor("Power on hours", 24, false, SensorType.Factor, s => Math.Max(s.Smart.MeasuredPowerOnHours, s.Smart.DetectedPowerOnHours));
if (_storage.IsNVMe)
_usageSensor = new Sensor("Used Space", 30, SensorType.Load, this, _settings);
_freeSpaceSensor = new Sensor("Free Space", 31, SensorType.Data, this, _settings);
ToggleSpaceSensors();
var totalSpaceSensor = new Sensor("Total Space", 32, SensorType.Data, this, _settings)
{
AddSensor("Temperature warning", index++, false, SensorType.Factor, s => s.Smart.TemperatureWarning.GetValueOrDefault());
AddSensor("Temperature critical", index++, false, SensorType.Factor, s => s.Smart.TemperatureCritical.GetValueOrDefault());
TryAddTemperatureSensor(index++, false, 1, SmartAttributeType.TemperatureSensor1);
TryAddTemperatureSensor(index++, false, 2, SmartAttributeType.TemperatureSensor2);
TryAddTemperatureSensor(index++, false, 3, SmartAttributeType.TemperatureSensor3);
TryAddTemperatureSensor(index++, false, 4, SmartAttributeType.TemperatureSensor4);
TryAddTemperatureSensor(index++, false, 5, SmartAttributeType.TemperatureSensor5);
TryAddTemperatureSensor(index++, false, 6, SmartAttributeType.TemperatureSensor6);
TryAddTemperatureSensor(index++, false, 7, SmartAttributeType.TemperatureSensor7);
TryAddTemperatureSensor(index++, false, 8, SmartAttributeType.TemperatureSensor8);
}
Value = (float)DataStorageSizeConverter.ByteToGigabyte(_storage.TotalSize)
};
ActivateSensor(totalSpaceSensor);
_sensorDiskReadActivity = new Sensor("Read Activity", 51, SensorType.Load, this, _settings);
ActivateSensor(_sensorDiskReadActivity);
@@ -312,29 +318,33 @@ public sealed class StorageDevice : Hardware, ISmart
_lastTime = currentTime;
}
private void ToggleUsageSensor()
private void ToggleSpaceSensors()
{
if (!_storage.IsDynamicDisk
&& !_storage.Partitions.Any(p => p.IsOtherOperatingSystemPartition))
{
ActivateSensor(_usageSensor);
ActivateSensor(_freeSpaceSensor);
}
else
{
DeactivateSensor(_usageSensor);
DeactivateSensor(_freeSpaceSensor);
}
}
private void UpdateUsageSensor()
private void UpdateSpaceSensors()
{
if (_storage.TotalSize > 0)
{
//Set sensor value
_usageSensor.Value = 100.0f - (100.0f * _storage.TotalFreeSize / _storage.TotalSize);
_freeSpaceSensor.Value = (float)DataStorageSizeConverter.ByteToGigabyte(_storage.TotalFreeSize.GetValueOrDefault());
}
else
{
_usageSensor.Value = null;
_freeSpaceSensor.Value = null;
}
}