Merge branch 'Nvidia VRAM AddOn'

This commit is contained in:
Michael Möller
2016-11-06 12:29:42 +01:00
4 changed files with 18 additions and 1 deletions

View File

@@ -50,6 +50,7 @@ namespace OpenHardwareMonitor.GUI {
case SensorType.Level: format = "{0:F1} %"; break;
case SensorType.Power: format = "{0:F1} W"; break;
case SensorType.Data: format = "{0:F1} GB"; break;
case SensorType.SmallData: format = "{0:F1} MB"; break;
case SensorType.Factor: format = "{0:F3}"; break;
}

View File

@@ -61,6 +61,10 @@ namespace OpenHardwareMonitor.GUI {
this.Image = Utilities.EmbeddedResources.GetImage("data.png");
this.Text = "Data";
break;
case SensorType.SmallData :
this.Image = Utilities.EmbeddedResources.GetImage("data.png");
this.Text = "Data";
break;
case SensorType.Factor:
this.Image = Utilities.EmbeddedResources.GetImage("factor.png");
this.Text = "Factors";

View File

@@ -26,6 +26,7 @@ namespace OpenHardwareMonitor.Hardware {
Factor, // 1
Power, // W
Data, // GB = 2^30 Bytes
SmallData, // MB = 2^20 Bytes
}
public struct SensorValue {

View File

@@ -26,6 +26,9 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
private readonly Sensor[] loads;
private readonly Sensor control;
private readonly Sensor memoryLoad;
private readonly Sensor memoryUsed;
private readonly Sensor memoryFree;
private readonly Sensor memoryAvail;
private readonly Control fanControl;
public NvidiaGPU(int adapterIndex, NvPhysicalGpuHandle handle,
@@ -75,7 +78,9 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
loads[1] = new Sensor("GPU Memory Controller", 1, SensorType.Load, this, settings);
loads[2] = new Sensor("GPU Video Engine", 2, SensorType.Load, this, settings);
memoryLoad = new Sensor("GPU Memory", 3, SensorType.Load, this, settings);
memoryFree = new Sensor("GPU Memory Free", 1, SensorType.SmallData, this, settings);
memoryUsed = new Sensor("GPU Memory Used", 2, SensorType.SmallData, this, settings);
memoryAvail = new Sensor("GPU Memory Total", 3, SensorType.SmallData, this, settings);
control = new Sensor("GPU Fan", 0, SensorType.Control, this, settings);
NvGPUCoolerSettings coolerSettings = GetCoolerSettings();
@@ -205,7 +210,13 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
uint totalMemory = memoryInfo.Values[0];
uint freeMemory = memoryInfo.Values[4];
float usedMemory = Math.Max(totalMemory - freeMemory, 0);
memoryFree.Value = (float)freeMemory/ 1024;
memoryAvail.Value = (float)totalMemory/ 1024;
memoryUsed.Value = usedMemory/ 1024;
memoryLoad.Value = 100f * usedMemory / totalMemory;
ActivateSensor(memoryAvail);
ActivateSensor(memoryUsed);
ActivateSensor(memoryFree);
ActivateSensor(memoryLoad);
}
}