mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-09-01 14:55:13 +00:00
Added a RAM sensor for used memory.
This commit is contained in:
@@ -14,6 +14,7 @@ namespace OpenHardwareMonitor.Hardware.RAM {
|
|||||||
internal class GenericRAM : Hardware {
|
internal class GenericRAM : Hardware {
|
||||||
|
|
||||||
private Sensor loadSensor;
|
private Sensor loadSensor;
|
||||||
|
private Sensor usedMemory;
|
||||||
private Sensor availableMemory;
|
private Sensor availableMemory;
|
||||||
|
|
||||||
public GenericRAM(string name, ISettings settings)
|
public GenericRAM(string name, ISettings settings)
|
||||||
@@ -22,7 +23,11 @@ namespace OpenHardwareMonitor.Hardware.RAM {
|
|||||||
loadSensor = new Sensor("Memory", 0, SensorType.Load, this, settings);
|
loadSensor = new Sensor("Memory", 0, SensorType.Load, this, settings);
|
||||||
ActivateSensor(loadSensor);
|
ActivateSensor(loadSensor);
|
||||||
|
|
||||||
availableMemory = new Sensor("Available Memory", 0, SensorType.Data, this,
|
usedMemory = new Sensor("Used Memory", 0, SensorType.Data, this,
|
||||||
|
settings);
|
||||||
|
ActivateSensor(usedMemory);
|
||||||
|
|
||||||
|
availableMemory = new Sensor("Available Memory", 1, SensorType.Data, this,
|
||||||
settings);
|
settings);
|
||||||
ActivateSensor(availableMemory);
|
ActivateSensor(availableMemory);
|
||||||
}
|
}
|
||||||
@@ -45,6 +50,9 @@ namespace OpenHardwareMonitor.Hardware.RAM {
|
|||||||
(100.0f * status.AvailablePhysicalMemory) /
|
(100.0f * status.AvailablePhysicalMemory) /
|
||||||
status.TotalPhysicalMemory;
|
status.TotalPhysicalMemory;
|
||||||
|
|
||||||
|
usedMemory.Value = (float)(status.TotalPhysicalMemory
|
||||||
|
- status.AvailablePhysicalMemory) / (1024 * 1024 * 1024);
|
||||||
|
|
||||||
availableMemory.Value = (float)status.AvailablePhysicalMemory /
|
availableMemory.Value = (float)status.AvailablePhysicalMemory /
|
||||||
(1024 * 1024 * 1024);
|
(1024 * 1024 * 1024);
|
||||||
}
|
}
|
||||||
|
@@ -10,5 +10,5 @@
|
|||||||
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("0.5.0.0")]
|
[assembly: AssemblyVersion("0.5.1.0")]
|
||||||
[assembly: AssemblyInformationalVersion("0.5.0 Beta")]
|
[assembly: AssemblyInformationalVersion("0.5.1 Beta")]
|
Reference in New Issue
Block a user