# HG changeset patch # User moel.mich # Date 1329170189 0 # Node ID 07a6126a47965adee976db73803dd95afb160c5b # Parent f580591971ce2f7314e0d7e7a8b22e8b07e5b621 Added additional smart attribute identification and a write amplification sensor for Sandforce based SSDs. diff -r f580591971ce -r 07a6126a4796 Hardware/HDD/AbstractHarddrive.cs --- a/Hardware/HDD/AbstractHarddrive.cs Mon Feb 13 20:34:39 2012 +0000 +++ b/Hardware/HDD/AbstractHarddrive.cs Mon Feb 13 21:56:29 2012 +0000 @@ -183,6 +183,7 @@ settings); sensors.Add(attribute, sensor); + ActivateSensor(sensor); sensorTypeAndChannels.Add(pair); } } @@ -192,13 +193,7 @@ 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 @@ sensor.Value = attribute.ConvertValue(value); } } - } + } + + UpdateAdditionalSensors(values); } count++; diff -r f580591971ce -r 07a6126a4796 Hardware/HDD/SSDSandforce.cs --- a/Hardware/HDD/SSDSandforce.cs Mon Feb 13 20:34:39 2012 +0000 +++ b/Hardware/HDD/SSDSandforce.cs Mon Feb 13 21:56:29 2012 +0000 @@ -44,30 +44,58 @@ 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 -r f580591971ce -r 07a6126a4796 Hardware/HDD/SmartNames.cs --- a/Hardware/HDD/SmartNames.cs Mon Feb 13 20:34:39 2012 +0000 +++ b/Hardware/HDD/SmartNames.cs Mon Feb 13 21:56:29 2012 +0000 @@ -493,5 +493,17 @@ 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 -r f580591971ce -r 07a6126a4796 Properties/AssemblyVersion.cs --- a/Properties/AssemblyVersion.cs Mon Feb 13 20:34:39 2012 +0000 +++ b/Properties/AssemblyVersion.cs Mon Feb 13 21:56:29 2012 +0000 @@ -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