Added additional smart attribute identification and a write amplification sensor for Sandforce based SSDs.
authormoel.mich
Mon, 13 Feb 2012 21:56:29 +0000
changeset 33907a6126a4796
parent 338 f580591971ce
child 340 600962f8a298
Added additional smart attribute identification and a write amplification sensor for Sandforce based SSDs.
Hardware/HDD/AbstractHarddrive.cs
Hardware/HDD/SSDSandforce.cs
Hardware/HDD/SmartNames.cs
Properties/AssemblyVersion.cs
     1.1 --- a/Hardware/HDD/AbstractHarddrive.cs	Mon Feb 13 20:34:39 2012 +0000
     1.2 +++ b/Hardware/HDD/AbstractHarddrive.cs	Mon Feb 13 21:56:29 2012 +0000
     1.3 @@ -183,6 +183,7 @@
     1.4              settings);
     1.5  
     1.6            sensors.Add(attribute, sensor);
     1.7 +          ActivateSensor(sensor);
     1.8            sensorTypeAndChannels.Add(pair);
     1.9          }     
    1.10        }
    1.11 @@ -192,13 +193,7 @@
    1.12        get { return HardwareType.HDD; }
    1.13      }
    1.14  
    1.15 -    public override ISensor[] Sensors {
    1.16 -      get {
    1.17 -        Sensor[] array = new Sensor[sensors.Count];
    1.18 -        sensors.Values.CopyTo(array, 0);
    1.19 -        return array;
    1.20 -      }
    1.21 -    }
    1.22 +    public virtual void UpdateAdditionalSensors(DriveAttributeValue[] values) {}
    1.23  
    1.24      public override void Update() {
    1.25        if (count == 0) {
    1.26 @@ -212,7 +207,9 @@
    1.27                sensor.Value = attribute.ConvertValue(value);
    1.28              }
    1.29            }
    1.30 -        }        
    1.31 +        }
    1.32 +
    1.33 +        UpdateAdditionalSensors(values);
    1.34        }
    1.35  
    1.36        count++; 
     2.1 --- a/Hardware/HDD/SSDSandforce.cs	Mon Feb 13 20:34:39 2012 +0000
     2.2 +++ b/Hardware/HDD/SSDSandforce.cs	Mon Feb 13 21:56:29 2012 +0000
     2.3 @@ -44,30 +44,58 @@
     2.4  
     2.5      private static readonly IEnumerable<SmartAttribute> smartAttributes =
     2.6        new List<SmartAttribute> {
     2.7 -      new SmartAttribute(0x05, SmartNames.RetiredBlockCount),
     2.8 +      new SmartAttribute(0x01, SmartNames.RawReadErrorRate),
     2.9 +      new SmartAttribute(0x05, SmartNames.RetiredBlockCount, RawToInt),
    2.10        new SmartAttribute(0x09, SmartNames.PowerOnHours, RawToInt),
    2.11        new SmartAttribute(0x0C, SmartNames.PowerCycleCount, RawToInt),
    2.12 -      new SmartAttribute(0xAB, SmartNames.ProgramFailCount),
    2.13 -      new SmartAttribute(0xAC, SmartNames.EraseFailCount),
    2.14 -      new SmartAttribute(0xAE, SmartNames.UnexpectedPowerLossCount),
    2.15 -      new SmartAttribute(0xB1, SmartNames.WearRangeDelta),
    2.16 -      new SmartAttribute(0xB5, SmartNames.AlternativeProgramFailCount),
    2.17 -      new SmartAttribute(0xB6, SmartNames.AlternativeEraseFailCount),
    2.18 +      new SmartAttribute(0xAB, SmartNames.ProgramFailCount, RawToInt),
    2.19 +      new SmartAttribute(0xAC, SmartNames.EraseFailCount, RawToInt),
    2.20 +      new SmartAttribute(0xAE, SmartNames.UnexpectedPowerLossCount, RawToInt),
    2.21 +      new SmartAttribute(0xB1, SmartNames.WearRangeDelta, RawToInt),
    2.22 +      new SmartAttribute(0xB5, SmartNames.AlternativeProgramFailCount, RawToInt),
    2.23 +      new SmartAttribute(0xB6, SmartNames.AlternativeEraseFailCount, RawToInt),
    2.24 +      new SmartAttribute(0xBB, SmartNames.UncorrectableErrorCount, RawToInt),
    2.25 +      new SmartAttribute(0xC2, SmartNames.Temperature, 
    2.26 +        (byte[] raw, byte value) => { return value; }), 
    2.27        new SmartAttribute(0xC3, SmartNames.UnrecoverableEcc), 
    2.28 -      new SmartAttribute(0xC4, SmartNames.ReallocationEventCount),
    2.29 -      new SmartAttribute(0xE7, SmartNames.RemainingLife, 
    2.30 -        null, SensorType.Level, 0),
    2.31 -      new SmartAttribute(0xF1, SmartNames.HostWrites, 
    2.32 -        (byte[] r, byte v) => { return RawToInt(r, v); }, 
    2.33 +      new SmartAttribute(0xC4, SmartNames.ReallocationEventCount, RawToInt),
    2.34 +      new SmartAttribute(0xE7, SmartNames.RemainingLife, null, 
    2.35 +        SensorType.Level, 0),
    2.36 +      new SmartAttribute(0xE9, SmartNames.ControllerWritesToNAND, RawToInt,
    2.37          SensorType.Data, 0),
    2.38 -      new SmartAttribute(0xF2, SmartNames.HostReads, 
    2.39 -        (byte[] r, byte v) => { return RawToInt(r, v); }, 
    2.40 -        SensorType.Data, 1)
    2.41 +      new SmartAttribute(0xEA, SmartNames.HostWritesToController, RawToInt, 
    2.42 +        SensorType.Data, 1),
    2.43 +      new SmartAttribute(0xF1, SmartNames.HostWrites, RawToInt, 
    2.44 +        SensorType.Data, 1),
    2.45 +      new SmartAttribute(0xF2, SmartNames.HostReads, RawToInt, 
    2.46 +        SensorType.Data, 2)
    2.47      };
    2.48  
    2.49 +    private Sensor writeAmplification;
    2.50 +
    2.51      public SSDSandforce(ISmart smart, string name, string firmwareRevision, 
    2.52        int index, ISettings settings) 
    2.53        : base(smart, name, firmwareRevision,  index, smartAttributes, settings) 
    2.54 -    { }
    2.55 +    {
    2.56 +      this.writeAmplification = new Sensor("Write Amplification", 1, 
    2.57 +        SensorType.Level, this, settings);    
    2.58 +    }
    2.59 +
    2.60 +    public override void UpdateAdditionalSensors(DriveAttributeValue[] values) {
    2.61 +      float? controllerWritesToNAND = null;
    2.62 +      float? hostWritesToController = null;
    2.63 +      foreach (DriveAttributeValue value in values) {
    2.64 +        if (value.Identifier == 0xE9)
    2.65 +          controllerWritesToNAND = RawToInt(value.RawValue, value.AttrValue);
    2.66 +
    2.67 +        if (value.Identifier == 0xEA)
    2.68 +          hostWritesToController = RawToInt(value.RawValue, value.AttrValue);
    2.69 +      }
    2.70 +      if (controllerWritesToNAND.HasValue && hostWritesToController.HasValue) {
    2.71 +        writeAmplification.Value = 100 *
    2.72 +          controllerWritesToNAND.Value / hostWritesToController.Value;
    2.73 +        ActivateSensor(writeAmplification);
    2.74 +      }
    2.75 +    }
    2.76    }
    2.77  }
     3.1 --- a/Hardware/HDD/SmartNames.cs	Mon Feb 13 20:34:39 2012 +0000
     3.2 +++ b/Hardware/HDD/SmartNames.cs	Mon Feb 13 21:56:29 2012 +0000
     3.3 @@ -493,5 +493,17 @@
     3.4      public static string ExceptionModeStatus {
     3.5        get { return "Exception Mode Status"; }
     3.6      }
     3.7 +
     3.8 +    public static string ControllerWritesToNAND {
     3.9 +      get { return "Controller Writes to NAND"; }
    3.10 +    }
    3.11 +
    3.12 +    public static string HostWritesToController {
    3.13 +      get { return "Host Writes to Controller"; }
    3.14 +    }
    3.15 +
    3.16 +    public static string RawReadErrorRate {
    3.17 +      get { return "Raw Read Error Rate"; }
    3.18 +    }
    3.19    }
    3.20  }
    3.21 \ No newline at end of file
     4.1 --- a/Properties/AssemblyVersion.cs	Mon Feb 13 20:34:39 2012 +0000
     4.2 +++ b/Properties/AssemblyVersion.cs	Mon Feb 13 21:56:29 2012 +0000
     4.3 @@ -37,5 +37,5 @@
     4.4  
     4.5  using System.Reflection;
     4.6  
     4.7 -[assembly: AssemblyVersion("0.4.0.1")]
     4.8 -[assembly: AssemblyInformationalVersion("0.4.0.1 Alpha")]
     4.9 \ No newline at end of file
    4.10 +[assembly: AssemblyVersion("0.4.0.2")]
    4.11 +[assembly: AssemblyInformationalVersion("0.4.0.2 Alpha")]
    4.12 \ No newline at end of file