@@ -5,34 +5,34 @@ namespace OpenHardwareMonitor.Hardware.Memory;
55
66internal 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 ;
0 commit comments