Skip to content

Commit daa8169

Browse files
committed
fixup! add new memory sensors
1 parent 32d6672 commit daa8169

3 files changed

Lines changed: 18 additions & 18 deletions

File tree

OpenHardwareMonitor/Utilities/Updater.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ internal static void CheckForUpdates(bool silent)
105105
if (string.Compare(CurrentVersion, newVersion, StringComparison.Ordinal) >= 0)
106106
{
107107
if (!silent)
108-
MessageBox.Show($"Your version is: {CurrentVersion}\nLatest released version is: {newVersion}\nNo need to update.", "Update", MessageBoxButtons.OK,
108+
MessageBox.Show($"Your version: {CurrentVersion}\nLast release: {newVersion}\nNo need to update.", "Update", MessageBoxButtons.OK,
109109
MessageBoxIcon.Information);
110110
return;
111111
}
112-
update = MessageBox.Show($"Your version is: {CurrentVersion}\nLatest released version is: {newVersion}\nDownload this update?",
112+
update = MessageBox.Show($"Your version: {CurrentVersion}\nLast release: {newVersion}\nDownload this update?",
113113
"Update", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes;
114114
}
115115
catch (Exception ex)

OpenHardwareMonitorLib/Hardware/Memory/GenericWindowsMemory.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,34 @@ namespace OpenHardwareMonitor.Hardware.Memory;
55

66
internal sealed class GenericWindowsMemory : Hardware
77
{
8-
private readonly Sensor _totalPhysicalMemory;
8+
private readonly Sensor _physicalMemoryTotal;
99
private readonly Sensor _physicalMemoryAvailable;
1010
private readonly Sensor _physicalMemoryLoad;
1111
private readonly Sensor _physicalMemoryUsed;
12+
13+
private readonly Sensor _virtualMemoryTotal;
1214
private readonly Sensor _virtualMemoryAvailable;
1315
private readonly Sensor _virtualMemoryLoad;
1416
private readonly Sensor _virtualMemoryUsed;
1517

16-
private readonly Sensor _commitLimit;
17-
private readonly Sensor _currentCommit;
1818
private readonly Sensor _kernelSize;
19+
1920
private readonly Sensor _processCount;
2021
private readonly Sensor _threadCount;
2122
private readonly Sensor _handleCount;
2223

2324
public GenericWindowsMemory(string name, ISettings settings) : base(name, new Identifier("ram"), settings)
2425
{
25-
ActivateSensor(_physicalMemoryLoad = new Sensor("Memory", 0, SensorType.Load, this, settings));
26+
ActivateSensor(_physicalMemoryLoad = new Sensor("Physical Memory", 0, SensorType.Load, this, settings));
2627
ActivateSensor(_virtualMemoryLoad = new Sensor("Virtual Memory", 1, SensorType.Load, this, settings));
2728

28-
ActivateSensor(_totalPhysicalMemory = new Sensor("Total Physical Memory", 0, SensorType.Data, this, settings));
29-
ActivateSensor(_physicalMemoryUsed = new Sensor("Memory Used", 1, SensorType.Data, this, settings));
30-
ActivateSensor(_physicalMemoryAvailable = new Sensor("Memory Available", 2, SensorType.Data, this, settings));
31-
ActivateSensor(_virtualMemoryUsed = new Sensor("Virtual Memory Used", 3, SensorType.Data, this, settings));
32-
ActivateSensor(_virtualMemoryAvailable = new Sensor("Virtual Memory Available", 4, SensorType.Data, this, settings));
33-
ActivateSensor(_commitLimit = new Sensor("Virtual memory commit limit", 5, SensorType.Data, this, settings));
34-
ActivateSensor(_currentCommit = new Sensor("Virtual memory in use", 6, SensorType.Data, this, settings));
35-
ActivateSensor(_kernelSize = new Sensor("Kernel memory usage", 7, SensorType.Data, this, settings));
29+
ActivateSensor(_physicalMemoryTotal = new Sensor("Physical Memory Total", 0, SensorType.Data, this, settings));
30+
ActivateSensor(_physicalMemoryUsed = new Sensor("Physical Memory Used", 1, SensorType.Data, this, settings));
31+
ActivateSensor(_physicalMemoryAvailable = new Sensor("Physical Memory Available", 2, SensorType.Data, this, settings));
32+
ActivateSensor(_virtualMemoryTotal = new Sensor("Virtual Memory Total", 3, SensorType.Data, this, settings));
33+
ActivateSensor(_virtualMemoryUsed = new Sensor("Virtual Memory Used", 4, SensorType.Data, this, settings));
34+
ActivateSensor(_virtualMemoryAvailable = new Sensor("Virtual Memory Available", 5, SensorType.Data, this, settings));
35+
ActivateSensor(_kernelSize = new Sensor("Kernel memory usage", 6, SensorType.Data, this, settings));
3636

3737
ActivateSensor(_processCount = new Sensor("Processes", 0, SensorType.IntFactor, this, settings));
3838
ActivateSensor(_threadCount = new Sensor("Threads", 1, SensorType.IntFactor, this, settings));
@@ -46,7 +46,7 @@ public override void Update()
4646
Kernel32.MEMORYSTATUSEX status = new() { dwLength = (uint)Marshal.SizeOf<Kernel32.MEMORYSTATUSEX>() };
4747
if (Kernel32.GlobalMemoryStatusEx(ref status))
4848
{
49-
_totalPhysicalMemory.Value = (float)status.ullTotalPhys / (1024 * 1024 * 1024);
49+
_physicalMemoryTotal.Value = (float)status.ullTotalPhys / (1024 * 1024 * 1024);
5050
_physicalMemoryUsed.Value = (float)(status.ullTotalPhys - status.ullAvailPhys) / (1024 * 1024 * 1024);
5151
_physicalMemoryAvailable.Value = (float)status.ullAvailPhys / (1024 * 1024 * 1024);
5252
_physicalMemoryLoad.Value = 100.0f - 100.0f * status.ullAvailPhys / status.ullTotalPhys;
@@ -60,8 +60,8 @@ public override void Update()
6060
Kernel32.PERFORMANCE_INFORMATION performanceInfo = new() { cb = (uint)Marshal.SizeOf<Kernel32.PERFORMANCE_INFORMATION>() };
6161
if (Kernel32.GetPerformanceInfo(ref performanceInfo, performanceInfo.cb))
6262
{
63-
_commitLimit.Value = (float)performanceInfo.CommitLimit * performanceInfo.PageSize / (1024 * 1024 * 1024);
64-
_currentCommit.Value = (float)performanceInfo.CommitTotal * performanceInfo.PageSize / (1024 * 1024 * 1024);
63+
_virtualMemoryTotal.Value = (float)performanceInfo.CommitLimit * performanceInfo.PageSize / (1024 * 1024 * 1024);
64+
//_virtualMemoryUsed.Value = (float)performanceInfo.CommitTotal * performanceInfo.PageSize / (1024 * 1024 * 1024);
6565
_kernelSize.Value = (float)performanceInfo.KernelNonpaged * performanceInfo.PageSize / (1024 * 1024 * 1024);
6666

6767
_processCount.Value = performanceInfo.ProcessCount;

OpenHardwareMonitorLib/Hardware/Memory/MemoryGroup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ internal class MemoryGroup : IGroup
88

99
public MemoryGroup(ISettings settings)
1010
{
11-
_hardware = new Hardware[] { Software.OperatingSystem.IsUnix ? new GenericLinuxMemory("Generic Memory", settings) : new GenericWindowsMemory("Generic Memory", settings) };
11+
_hardware = [Software.OperatingSystem.IsUnix ? new GenericLinuxMemory("Memory", settings) : new GenericWindowsMemory("Memory", settings)];
1212
}
1313

1414
public string GetReport()

0 commit comments

Comments
 (0)