diff --git a/Hardware/HDD/AbstractHarddrive.cs b/Hardware/HDD/AbstractHarddrive.cs index 3bd0185..85a675d 100644 --- a/Hardware/HDD/AbstractHarddrive.cs +++ b/Hardware/HDD/AbstractHarddrive.cs @@ -183,6 +183,7 @@ namespace OpenHardwareMonitor.Hardware.HDD { settings); sensors.Add(attribute, sensor); + ActivateSensor(sensor); sensorTypeAndChannels.Add(pair); } } @@ -192,13 +193,7 @@ namespace OpenHardwareMonitor.Hardware.HDD { get { return HardwareType.HDD; } } - public override ISensor[] Sensors { - get { - Sensor[] array = new Sensor[sensors.Count]; - sensors.Values.CopyTo(array, 0); - return array; - } - } + public virtual void UpdateAdditionalSensors(DriveAttributeValue[] values) {} public override void Update() { if (count == 0) { @@ -212,7 +207,9 @@ namespace OpenHardwareMonitor.Hardware.HDD { sensor.Value = attribute.ConvertValue(value); } } - } + } + + UpdateAdditionalSensors(values); } count++; diff --git a/Hardware/HDD/SSDSandforce.cs b/Hardware/HDD/SSDSandforce.cs index 0f72b55..94ae180 100644 --- a/Hardware/HDD/SSDSandforce.cs +++ b/Hardware/HDD/SSDSandforce.cs @@ -44,30 +44,58 @@ namespace OpenHardwareMonitor.Hardware.HDD { private static readonly IEnumerable smartAttributes = new List { - new SmartAttribute(0x05, SmartNames.RetiredBlockCount), + new SmartAttribute(0x01, SmartNames.RawReadErrorRate), + new SmartAttribute(0x05, SmartNames.RetiredBlockCount, RawToInt), new SmartAttribute(0x09, SmartNames.PowerOnHours, RawToInt), new SmartAttribute(0x0C, SmartNames.PowerCycleCount, RawToInt), - new SmartAttribute(0xAB, SmartNames.ProgramFailCount), - new SmartAttribute(0xAC, SmartNames.EraseFailCount), - new SmartAttribute(0xAE, SmartNames.UnexpectedPowerLossCount), - new SmartAttribute(0xB1, SmartNames.WearRangeDelta), - new SmartAttribute(0xB5, SmartNames.AlternativeProgramFailCount), - new SmartAttribute(0xB6, SmartNames.AlternativeEraseFailCount), + new SmartAttribute(0xAB, SmartNames.ProgramFailCount, RawToInt), + new SmartAttribute(0xAC, SmartNames.EraseFailCount, RawToInt), + new SmartAttribute(0xAE, SmartNames.UnexpectedPowerLossCount, RawToInt), + new SmartAttribute(0xB1, SmartNames.WearRangeDelta, RawToInt), + new SmartAttribute(0xB5, SmartNames.AlternativeProgramFailCount, RawToInt), + new SmartAttribute(0xB6, SmartNames.AlternativeEraseFailCount, RawToInt), + new SmartAttribute(0xBB, SmartNames.UncorrectableErrorCount, RawToInt), + new SmartAttribute(0xC2, SmartNames.Temperature, + (byte[] raw, byte value) => { return value; }), new SmartAttribute(0xC3, SmartNames.UnrecoverableEcc), - new SmartAttribute(0xC4, SmartNames.ReallocationEventCount), - new SmartAttribute(0xE7, SmartNames.RemainingLife, - null, SensorType.Level, 0), - new SmartAttribute(0xF1, SmartNames.HostWrites, - (byte[] r, byte v) => { return RawToInt(r, v); }, + new SmartAttribute(0xC4, SmartNames.ReallocationEventCount, RawToInt), + new SmartAttribute(0xE7, SmartNames.RemainingLife, null, + SensorType.Level, 0), + new SmartAttribute(0xE9, SmartNames.ControllerWritesToNAND, RawToInt, SensorType.Data, 0), - new SmartAttribute(0xF2, SmartNames.HostReads, - (byte[] r, byte v) => { return RawToInt(r, v); }, - SensorType.Data, 1) + new SmartAttribute(0xEA, SmartNames.HostWritesToController, RawToInt, + SensorType.Data, 1), + new SmartAttribute(0xF1, SmartNames.HostWrites, RawToInt, + SensorType.Data, 1), + new SmartAttribute(0xF2, SmartNames.HostReads, RawToInt, + SensorType.Data, 2) }; + private Sensor writeAmplification; + public SSDSandforce(ISmart smart, string name, string firmwareRevision, int index, ISettings settings) : base(smart, name, firmwareRevision, index, smartAttributes, settings) - { } + { + this.writeAmplification = new Sensor("Write Amplification", 1, + SensorType.Level, this, settings); + } + + public override void UpdateAdditionalSensors(DriveAttributeValue[] values) { + float? controllerWritesToNAND = null; + float? hostWritesToController = null; + foreach (DriveAttributeValue value in values) { + if (value.Identifier == 0xE9) + controllerWritesToNAND = RawToInt(value.RawValue, value.AttrValue); + + if (value.Identifier == 0xEA) + hostWritesToController = RawToInt(value.RawValue, value.AttrValue); + } + if (controllerWritesToNAND.HasValue && hostWritesToController.HasValue) { + writeAmplification.Value = 100 * + controllerWritesToNAND.Value / hostWritesToController.Value; + ActivateSensor(writeAmplification); + } + } } } diff --git a/Hardware/HDD/SmartNames.cs b/Hardware/HDD/SmartNames.cs index 09e5909..1fd8567 100644 --- a/Hardware/HDD/SmartNames.cs +++ b/Hardware/HDD/SmartNames.cs @@ -493,5 +493,17 @@ namespace OpenHardwareMonitor.Hardware.HDD { public static string ExceptionModeStatus { get { return "Exception Mode Status"; } } + + public static string ControllerWritesToNAND { + get { return "Controller Writes to NAND"; } + } + + public static string HostWritesToController { + get { return "Host Writes to Controller"; } + } + + public static string RawReadErrorRate { + get { return "Raw Read Error Rate"; } + } } } \ No newline at end of file diff --git a/Properties/AssemblyVersion.cs b/Properties/AssemblyVersion.cs index efa1c1c..6a7cdf9 100644 --- a/Properties/AssemblyVersion.cs +++ b/Properties/AssemblyVersion.cs @@ -37,5 +37,5 @@ using System.Reflection; -[assembly: AssemblyVersion("0.4.0.1")] -[assembly: AssemblyInformationalVersion("0.4.0.1 Alpha")] \ No newline at end of file +[assembly: AssemblyVersion("0.4.0.2")] +[assembly: AssemblyInformationalVersion("0.4.0.2 Alpha")] \ No newline at end of file