Added a new sensor type "Factor" for dimensionless values (and similar) that are not to be shown as percent ("Level" type). Changed the write amplification sensor to use the new "Factor" sensor type. Added the temperature SMART attribute for Sandforce SSDs as hidden sensor (as it may show fake results on some hardware).

This commit is contained in:
Michael Möller
2012-02-14 23:07:55 +00:00
parent 3f9d9da2f0
commit f8867d671a
12 changed files with 42 additions and 31 deletions

View File

@@ -16,7 +16,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Michael Möller <m.moeller@gmx.ch>. Michael Möller <m.moeller@gmx.ch>.
Portions created by the Initial Developer are Copyright (C) 2009-2011 Portions created by the Initial Developer are Copyright (C) 2009-2012
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@@ -57,16 +57,8 @@ namespace OpenHardwareMonitor.GUI {
this.hardware = hardware; this.hardware = hardware;
this.Image = HardwareTypeImage.Instance.GetImage(hardware.HardwareType); this.Image = HardwareTypeImage.Instance.GetImage(hardware.HardwareType);
typeNodes.Add(new TypeNode(SensorType.Voltage)); foreach (SensorType sensorType in Enum.GetValues(typeof(SensorType)))
typeNodes.Add(new TypeNode(SensorType.Clock)); typeNodes.Add(new TypeNode(sensorType));
typeNodes.Add(new TypeNode(SensorType.Temperature));
typeNodes.Add(new TypeNode(SensorType.Load));
typeNodes.Add(new TypeNode(SensorType.Fan));
typeNodes.Add(new TypeNode(SensorType.Flow));
typeNodes.Add(new TypeNode(SensorType.Control));
typeNodes.Add(new TypeNode(SensorType.Level));
typeNodes.Add(new TypeNode(SensorType.Power));
typeNodes.Add(new TypeNode(SensorType.Data));
foreach (ISensor sensor in hardware.Sensors) foreach (ISensor sensor in hardware.Sensors)
SensorAdded(sensor); SensorAdded(sensor);

View File

@@ -16,7 +16,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Michael Möller <m.moeller@gmx.ch>. Michael Möller <m.moeller@gmx.ch>.
Portions created by the Initial Developer are Copyright (C) 2010-2011 Portions created by the Initial Developer are Copyright (C) 2010-2012
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@@ -521,6 +521,9 @@ namespace OpenHardwareMonitor.GUI {
case SensorType.Data: case SensorType.Data:
format = "{0:F1} GB"; format = "{0:F1} GB";
break; break;
case SensorType.Factor:
format = "{0:F3}";
break;
} }
if (sensor.SensorType == SensorType.Temperature && if (sensor.SensorType == SensorType.Temperature &&

View File

@@ -16,7 +16,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Michael Möller <m.moeller@gmx.ch>. Michael Möller <m.moeller@gmx.ch>.
Portions created by the Initial Developer are Copyright (C) 2009-2011 Portions created by the Initial Developer are Copyright (C) 2009-2012
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@@ -77,6 +77,7 @@ namespace OpenHardwareMonitor.GUI {
case SensorType.Level: format = "{0:F1} %"; break; case SensorType.Level: format = "{0:F1} %"; break;
case SensorType.Power: format = "{0:F1} W"; break; case SensorType.Power: format = "{0:F1} W"; break;
case SensorType.Data: format = "{0:F1} GB"; break; case SensorType.Data: format = "{0:F1} GB"; break;
case SensorType.Factor: format = "{0:F3}"; break;
} }
bool hidden = settings.GetValue(new Identifier(sensor.Identifier, bool hidden = settings.GetValue(new Identifier(sensor.Identifier,

View File

@@ -16,7 +16,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Michael Möller <m.moeller@gmx.ch>. Michael Möller <m.moeller@gmx.ch>.
Portions created by the Initial Developer are Copyright (C) 2009-2011 Portions created by the Initial Developer are Copyright (C) 2009-2012
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@@ -181,17 +181,17 @@ namespace OpenHardwareMonitor.GUI {
switch (sensor.SensorType) { switch (sensor.SensorType) {
case SensorType.Voltage: case SensorType.Voltage:
return string.Format("{0:F11}", sensor.Value); return string.Format("{0:F1}", sensor.Value);
case SensorType.Clock: case SensorType.Clock:
return string.Format("{0:F11}", 1e-3f * sensor.Value); return string.Format("{0:F1}", 1e-3f * sensor.Value);
case SensorType.Load: case SensorType.Load:
return string.Format("{0:F0}", sensor.Value); return string.Format("{0:F0}", sensor.Value);
case SensorType.Temperature: case SensorType.Temperature:
return string.Format("{0:F0}", sensor.Value); return string.Format("{0:F0}", sensor.Value);
case SensorType.Fan: case SensorType.Fan:
return string.Format("{0:F11}", 1e-3f * sensor.Value); return string.Format("{0:F1}", 1e-3f * sensor.Value);
case SensorType.Flow: case SensorType.Flow:
return string.Format("{0:F11}", 1e-3f * sensor.Value); return string.Format("{0:F1}", 1e-3f * sensor.Value);
case SensorType.Control: case SensorType.Control:
return string.Format("{0:F0}", sensor.Value); return string.Format("{0:F0}", sensor.Value);
case SensorType.Level: case SensorType.Level:
@@ -200,6 +200,8 @@ namespace OpenHardwareMonitor.GUI {
return string.Format("{0:F0}", sensor.Value); return string.Format("{0:F0}", sensor.Value);
case SensorType.Data: case SensorType.Data:
return string.Format("{0:F0}", sensor.Value); return string.Format("{0:F0}", sensor.Value);
case SensorType.Factor:
return string.Format("{0:F1}", sensor.Value);
} }
return "-"; return "-";
} }
@@ -289,6 +291,7 @@ namespace OpenHardwareMonitor.GUI {
case SensorType.Level: format = "\n{0}: {1:F1} %"; break; case SensorType.Level: format = "\n{0}: {1:F1} %"; break;
case SensorType.Power: format = "\n{0}: {1:F0} W"; break; case SensorType.Power: format = "\n{0}: {1:F0} W"; break;
case SensorType.Data: format = "\n{0}: {1:F0} GB"; break; case SensorType.Data: format = "\n{0}: {1:F0} GB"; break;
case SensorType.Factor: format = "\n{0}: {1:F3} GB"; break;
} }
string formattedValue = string.Format(format, sensor.Name, sensor.Value); string formattedValue = string.Format(format, sensor.Name, sensor.Value);
string hardwareName = sensor.Hardware.Name; string hardwareName = sensor.Hardware.Name;

View File

@@ -16,7 +16,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Michael Möller <m.moeller@gmx.ch>. Michael Möller <m.moeller@gmx.ch>.
Portions created by the Initial Developer are Copyright (C) 2009-2011 Portions created by the Initial Developer are Copyright (C) 2009-2012
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@@ -88,6 +88,10 @@ namespace OpenHardwareMonitor.GUI {
this.Image = Utilities.EmbeddedResources.GetImage("data.png"); this.Image = Utilities.EmbeddedResources.GetImage("data.png");
this.Text = "Data"; this.Text = "Data";
break; break;
case SensorType.Factor:
this.Image = Utilities.EmbeddedResources.GetImage("factor.png");
this.Text = "Factors";
break;
} }
NodeAdded += new NodeEventHandler(TypeNode_NodeAdded); NodeAdded += new NodeEventHandler(TypeNode_NodeAdded);

View File

@@ -179,8 +179,8 @@ namespace OpenHardwareMonitor.Hardware.HDD {
if (!sensorTypeAndChannels.Contains(pair)) { if (!sensorTypeAndChannels.Contains(pair)) {
Sensor sensor = new Sensor(attribute.Name, Sensor sensor = new Sensor(attribute.Name,
attribute.SensorChannel, attribute.SensorType.Value, this, attribute.SensorChannel, attribute.DefaultHiddenSensor,
settings); attribute.SensorType.Value, this, null, settings);
sensors.Add(attribute, sensor); sensors.Add(attribute, sensor);
ActivateSensor(sensor); ActivateSensor(sensor);

View File

@@ -55,8 +55,8 @@ namespace OpenHardwareMonitor.Hardware.HDD {
new SmartAttribute(0xB5, SmartNames.AlternativeProgramFailCount, RawToInt), new SmartAttribute(0xB5, SmartNames.AlternativeProgramFailCount, RawToInt),
new SmartAttribute(0xB6, SmartNames.AlternativeEraseFailCount, RawToInt), new SmartAttribute(0xB6, SmartNames.AlternativeEraseFailCount, RawToInt),
new SmartAttribute(0xBB, SmartNames.UncorrectableErrorCount, RawToInt), new SmartAttribute(0xBB, SmartNames.UncorrectableErrorCount, RawToInt),
new SmartAttribute(0xC2, SmartNames.Temperature, new SmartAttribute(0xC2, SmartNames.Temperature, (byte[] raw, byte value)
(byte[] raw, byte value) => { return value; }), => { return value; }, SensorType.Temperature, 0, true),
new SmartAttribute(0xC3, SmartNames.UnrecoverableEcc), new SmartAttribute(0xC3, SmartNames.UnrecoverableEcc),
new SmartAttribute(0xC4, SmartNames.ReallocationEventCount, RawToInt), new SmartAttribute(0xC4, SmartNames.ReallocationEventCount, RawToInt),
new SmartAttribute(0xE7, SmartNames.RemainingLife, null, new SmartAttribute(0xE7, SmartNames.RemainingLife, null,
@@ -78,7 +78,7 @@ namespace OpenHardwareMonitor.Hardware.HDD {
: base(smart, name, firmwareRevision, index, smartAttributes, settings) : base(smart, name, firmwareRevision, index, smartAttributes, settings)
{ {
this.writeAmplification = new Sensor("Write Amplification", 1, this.writeAmplification = new Sensor("Write Amplification", 1,
SensorType.Level, this, settings); SensorType.Factor, this, settings);
} }
public override void UpdateAdditionalSensors(DriveAttributeValue[] values) { public override void UpdateAdditionalSensors(DriveAttributeValue[] values) {
@@ -92,7 +92,7 @@ namespace OpenHardwareMonitor.Hardware.HDD {
hostWritesToController = RawToInt(value.RawValue, value.AttrValue); hostWritesToController = RawToInt(value.RawValue, value.AttrValue);
} }
if (controllerWritesToNAND.HasValue && hostWritesToController.HasValue) { if (controllerWritesToNAND.HasValue && hostWritesToController.HasValue) {
writeAmplification.Value = 100 * writeAmplification.Value =
controllerWritesToNAND.Value / hostWritesToController.Value; controllerWritesToNAND.Value / hostWritesToController.Value;
ActivateSensor(writeAmplification); ActivateSensor(writeAmplification);
} }

View File

@@ -16,7 +16,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Michael Möller <m.moeller@gmx.ch>. Michael Möller <m.moeller@gmx.ch>.
Portions created by the Initial Developer are Copyright (C) 2011 Portions created by the Initial Developer are Copyright (C) 2011-2012
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@@ -75,15 +75,17 @@ namespace OpenHardwareMonitor.Hardware.HDD {
/// <param name="sensorChannel">If there exists more than one attribute with /// <param name="sensorChannel">If there exists more than one attribute with
/// the same sensor channel and type, then a sensor is created only for the /// the same sensor channel and type, then a sensor is created only for the
/// first attribute.</param> /// first attribute.</param>
/// <param name="defaultHiddenSensor">True to hide the sensor initially.</param>
public SmartAttribute(byte identifier, string name, public SmartAttribute(byte identifier, string name,
RawValueConversion rawValueConversion, SensorType? sensorType, RawValueConversion rawValueConversion, SensorType? sensorType,
int sensorChannel) int sensorChannel, bool defaultHiddenSensor = false)
{ {
this.Identifier = identifier; this.Identifier = identifier;
this.Name = name; this.Name = name;
this.rawValueConversion = rawValueConversion; this.rawValueConversion = rawValueConversion;
this.SensorType = sensorType; this.SensorType = sensorType;
this.SensorChannel = sensorChannel; this.SensorChannel = sensorChannel;
this.DefaultHiddenSensor = defaultHiddenSensor;
} }
/// <summary> /// <summary>
@@ -97,6 +99,8 @@ namespace OpenHardwareMonitor.Hardware.HDD {
public int SensorChannel { get; private set; } public int SensorChannel { get; private set; }
public bool DefaultHiddenSensor { get; private set; }
public bool HasRawValueConversion { public bool HasRawValueConversion {
get { get {
return rawValueConversion != null; return rawValueConversion != null;

View File

@@ -16,7 +16,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Michael Möller <m.moeller@gmx.ch>. Michael Möller <m.moeller@gmx.ch>.
Portions created by the Initial Developer are Copyright (C) 2009-2011 Portions created by the Initial Developer are Copyright (C) 2009-2012
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@@ -50,8 +50,9 @@ namespace OpenHardwareMonitor.Hardware {
Flow, // L/h Flow, // L/h
Control, // % Control, // %
Level, // % Level, // %
Factor, // 1
Power, // W Power, // W
Data, // GB = 2^30 Bytes Data, // GB = 2^30 Bytes
} }
public struct SensorValue { public struct SensorValue {

View File

@@ -225,6 +225,9 @@
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Resources\data.png" /> <EmbeddedResource Include="Resources\data.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\factor.png" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions> <ProjectExtensions>
<VisualStudio AllowExistingFolder="true" /> <VisualStudio AllowExistingFolder="true" />

View File

@@ -37,5 +37,5 @@
using System.Reflection; using System.Reflection;
[assembly: AssemblyVersion("0.4.0.2")] [assembly: AssemblyVersion("0.4.0.3")]
[assembly: AssemblyInformationalVersion("0.4.0.2 Alpha")] [assembly: AssemblyInformationalVersion("0.4.0.3 Alpha")]

BIN
Resources/factor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 533 B