mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-09-02 15:25:22 +00:00
Release version 0.1.11. Added support for load percentage sensor type. Added load sensors for CPUs and ATI GPUs.
This commit is contained in:
@@ -54,8 +54,9 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
this.Image = hardware.Icon;
|
this.Image = hardware.Icon;
|
||||||
|
|
||||||
typeNodes.Add(new TypeNode(SensorType.Voltage));
|
typeNodes.Add(new TypeNode(SensorType.Voltage));
|
||||||
typeNodes.Add(new TypeNode(SensorType.Clock));
|
typeNodes.Add(new TypeNode(SensorType.Clock));
|
||||||
typeNodes.Add(new TypeNode(SensorType.Temperature));
|
typeNodes.Add(new TypeNode(SensorType.Temperature));
|
||||||
|
typeNodes.Add(new TypeNode(SensorType.Load));
|
||||||
typeNodes.Add(new TypeNode(SensorType.Fan));
|
typeNodes.Add(new TypeNode(SensorType.Fan));
|
||||||
|
|
||||||
foreach (ISensor sensor in hardware.Sensors)
|
foreach (ISensor sensor in hardware.Sensors)
|
||||||
|
29
GUI/MainForm.Designer.cs
generated
29
GUI/MainForm.Designer.cs
generated
@@ -88,6 +88,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
this.sensorsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.sensorsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.voltMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.voltMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.clocksMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.clocksMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.loadMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.tempMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.tempMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.fansMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.fansMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
@@ -328,9 +329,10 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
this.voltMenuItem,
|
this.voltMenuItem,
|
||||||
this.clocksMenuItem,
|
this.clocksMenuItem,
|
||||||
this.tempMenuItem,
|
this.tempMenuItem,
|
||||||
|
this.loadMenuItem,
|
||||||
this.fansMenuItem});
|
this.fansMenuItem});
|
||||||
this.sensorsToolStripMenuItem.Name = "sensorsToolStripMenuItem";
|
this.sensorsToolStripMenuItem.Name = "sensorsToolStripMenuItem";
|
||||||
this.sensorsToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
|
this.sensorsToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||||
this.sensorsToolStripMenuItem.Text = "Sensors";
|
this.sensorsToolStripMenuItem.Text = "Sensors";
|
||||||
//
|
//
|
||||||
// voltMenuItem
|
// voltMenuItem
|
||||||
@@ -339,7 +341,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
this.voltMenuItem.CheckOnClick = true;
|
this.voltMenuItem.CheckOnClick = true;
|
||||||
this.voltMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
|
this.voltMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||||
this.voltMenuItem.Name = "voltMenuItem";
|
this.voltMenuItem.Name = "voltMenuItem";
|
||||||
this.voltMenuItem.Size = new System.Drawing.Size(147, 22);
|
this.voltMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||||
this.voltMenuItem.Text = "Voltages";
|
this.voltMenuItem.Text = "Voltages";
|
||||||
this.voltMenuItem.CheckedChanged += new System.EventHandler(this.UpdateSensorTypeChecked);
|
this.voltMenuItem.CheckedChanged += new System.EventHandler(this.UpdateSensorTypeChecked);
|
||||||
//
|
//
|
||||||
@@ -349,17 +351,27 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
this.clocksMenuItem.CheckOnClick = true;
|
this.clocksMenuItem.CheckOnClick = true;
|
||||||
this.clocksMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
|
this.clocksMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||||
this.clocksMenuItem.Name = "clocksMenuItem";
|
this.clocksMenuItem.Name = "clocksMenuItem";
|
||||||
this.clocksMenuItem.Size = new System.Drawing.Size(147, 22);
|
this.clocksMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||||
this.clocksMenuItem.Text = "Clocks";
|
this.clocksMenuItem.Text = "Clocks";
|
||||||
this.clocksMenuItem.CheckedChanged += new System.EventHandler(this.UpdateSensorTypeChecked);
|
this.clocksMenuItem.CheckedChanged += new System.EventHandler(this.UpdateSensorTypeChecked);
|
||||||
//
|
//
|
||||||
|
// loadMenuItem
|
||||||
|
//
|
||||||
|
this.loadMenuItem.Checked = true;
|
||||||
|
this.loadMenuItem.CheckOnClick = true;
|
||||||
|
this.loadMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||||
|
this.loadMenuItem.Name = "loadMenuItem";
|
||||||
|
this.loadMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||||
|
this.loadMenuItem.Text = "Load";
|
||||||
|
this.loadMenuItem.CheckedChanged += new System.EventHandler(this.UpdateSensorTypeChecked);
|
||||||
|
//
|
||||||
// tempMenuItem
|
// tempMenuItem
|
||||||
//
|
//
|
||||||
this.tempMenuItem.Checked = true;
|
this.tempMenuItem.Checked = true;
|
||||||
this.tempMenuItem.CheckOnClick = true;
|
this.tempMenuItem.CheckOnClick = true;
|
||||||
this.tempMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
|
this.tempMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||||
this.tempMenuItem.Name = "tempMenuItem";
|
this.tempMenuItem.Name = "tempMenuItem";
|
||||||
this.tempMenuItem.Size = new System.Drawing.Size(147, 22);
|
this.tempMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||||
this.tempMenuItem.Text = "Temperatures";
|
this.tempMenuItem.Text = "Temperatures";
|
||||||
this.tempMenuItem.CheckedChanged += new System.EventHandler(this.UpdateSensorTypeChecked);
|
this.tempMenuItem.CheckedChanged += new System.EventHandler(this.UpdateSensorTypeChecked);
|
||||||
//
|
//
|
||||||
@@ -369,14 +381,14 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
this.fansMenuItem.CheckOnClick = true;
|
this.fansMenuItem.CheckOnClick = true;
|
||||||
this.fansMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
|
this.fansMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||||
this.fansMenuItem.Name = "fansMenuItem";
|
this.fansMenuItem.Name = "fansMenuItem";
|
||||||
this.fansMenuItem.Size = new System.Drawing.Size(147, 22);
|
this.fansMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||||
this.fansMenuItem.Text = "Fans";
|
this.fansMenuItem.Text = "Fans";
|
||||||
this.fansMenuItem.CheckedChanged += new System.EventHandler(this.UpdateSensorTypeChecked);
|
this.fansMenuItem.CheckedChanged += new System.EventHandler(this.UpdateSensorTypeChecked);
|
||||||
//
|
//
|
||||||
// toolStripMenuItem1
|
// toolStripMenuItem1
|
||||||
//
|
//
|
||||||
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
||||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(111, 6);
|
this.toolStripMenuItem1.Size = new System.Drawing.Size(149, 6);
|
||||||
//
|
//
|
||||||
// plotMenuItem
|
// plotMenuItem
|
||||||
//
|
//
|
||||||
@@ -384,7 +396,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
this.plotMenuItem.CheckOnClick = true;
|
this.plotMenuItem.CheckOnClick = true;
|
||||||
this.plotMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
|
this.plotMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||||
this.plotMenuItem.Name = "plotMenuItem";
|
this.plotMenuItem.Name = "plotMenuItem";
|
||||||
this.plotMenuItem.Size = new System.Drawing.Size(114, 22);
|
this.plotMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||||
this.plotMenuItem.Text = "Plot";
|
this.plotMenuItem.Text = "Plot";
|
||||||
this.plotMenuItem.CheckedChanged += new System.EventHandler(this.plotToolStripMenuItem_CheckedChanged);
|
this.plotMenuItem.CheckedChanged += new System.EventHandler(this.plotToolStripMenuItem_CheckedChanged);
|
||||||
//
|
//
|
||||||
@@ -400,7 +412,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
//
|
//
|
||||||
this.hddMenuItem.CheckOnClick = true;
|
this.hddMenuItem.CheckOnClick = true;
|
||||||
this.hddMenuItem.Name = "hddMenuItem";
|
this.hddMenuItem.Name = "hddMenuItem";
|
||||||
this.hddMenuItem.Size = new System.Drawing.Size(141, 22);
|
this.hddMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||||
this.hddMenuItem.Text = "HDD sensors";
|
this.hddMenuItem.Text = "HDD sensors";
|
||||||
this.hddMenuItem.CheckedChanged += new System.EventHandler(this.hddsensorsToolStripMenuItem_CheckedChanged);
|
this.hddMenuItem.CheckedChanged += new System.EventHandler(this.hddsensorsToolStripMenuItem_CheckedChanged);
|
||||||
//
|
//
|
||||||
@@ -518,6 +530,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
private System.Windows.Forms.ToolStripMenuItem fansMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem fansMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem voltMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem voltMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem hddMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem hddMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem loadMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -130,6 +130,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
|
|
||||||
voltMenuItem.Checked = Utilities.Config.Get(voltMenuItem.Name, true);
|
voltMenuItem.Checked = Utilities.Config.Get(voltMenuItem.Name, true);
|
||||||
clocksMenuItem.Checked = Utilities.Config.Get(clocksMenuItem.Name, true);
|
clocksMenuItem.Checked = Utilities.Config.Get(clocksMenuItem.Name, true);
|
||||||
|
loadMenuItem.Checked = Utilities.Config.Get(loadMenuItem.Name, true);
|
||||||
tempMenuItem.Checked = Utilities.Config.Get(tempMenuItem.Name, true);
|
tempMenuItem.Checked = Utilities.Config.Get(tempMenuItem.Name, true);
|
||||||
fansMenuItem.Checked = Utilities.Config.Get(fansMenuItem.Name, true);
|
fansMenuItem.Checked = Utilities.Config.Get(fansMenuItem.Name, true);
|
||||||
|
|
||||||
@@ -235,6 +236,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
|
|
||||||
Utilities.Config.Set(voltMenuItem.Name, voltMenuItem.Checked);
|
Utilities.Config.Set(voltMenuItem.Name, voltMenuItem.Checked);
|
||||||
Utilities.Config.Set(clocksMenuItem.Name, clocksMenuItem.Checked);
|
Utilities.Config.Set(clocksMenuItem.Name, clocksMenuItem.Checked);
|
||||||
|
Utilities.Config.Set(loadMenuItem.Name, loadMenuItem.Checked);
|
||||||
Utilities.Config.Set(tempMenuItem.Name, tempMenuItem.Checked);
|
Utilities.Config.Set(tempMenuItem.Name, tempMenuItem.Checked);
|
||||||
Utilities.Config.Set(fansMenuItem.Name, fansMenuItem.Checked);
|
Utilities.Config.Set(fansMenuItem.Name, fansMenuItem.Checked);
|
||||||
|
|
||||||
@@ -319,6 +321,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
foreach (HardwareNode node in root.Nodes) {
|
foreach (HardwareNode node in root.Nodes) {
|
||||||
node.SetVisible(SensorType.Voltage, voltMenuItem.Checked);
|
node.SetVisible(SensorType.Voltage, voltMenuItem.Checked);
|
||||||
node.SetVisible(SensorType.Clock, clocksMenuItem.Checked);
|
node.SetVisible(SensorType.Clock, clocksMenuItem.Checked);
|
||||||
|
node.SetVisible(SensorType.Load, loadMenuItem.Checked);
|
||||||
node.SetVisible(SensorType.Temperature, tempMenuItem.Checked);
|
node.SetVisible(SensorType.Temperature, tempMenuItem.Checked);
|
||||||
node.SetVisible(SensorType.Fan, fansMenuItem.Checked);
|
node.SetVisible(SensorType.Fan, fansMenuItem.Checked);
|
||||||
}
|
}
|
||||||
|
@@ -59,6 +59,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
switch (sensor.SensorType) {
|
switch (sensor.SensorType) {
|
||||||
case SensorType.Voltage: format = "{0:F2} V"; break;
|
case SensorType.Voltage: format = "{0:F2} V"; break;
|
||||||
case SensorType.Clock: format = "{0:F0} MHz"; break;
|
case SensorType.Clock: format = "{0:F0} MHz"; break;
|
||||||
|
case SensorType.Load: format = "{0:F1} %"; break;
|
||||||
case SensorType.Temperature: format = "{0:F1} °C"; break;
|
case SensorType.Temperature: format = "{0:F1} °C"; break;
|
||||||
case SensorType.Fan: format = "{0:F0} RPM"; break;
|
case SensorType.Fan: format = "{0:F0} RPM"; break;
|
||||||
}
|
}
|
||||||
|
@@ -58,6 +58,10 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
this.Image = Utilities.EmbeddedResources.GetImage("clock.png");
|
this.Image = Utilities.EmbeddedResources.GetImage("clock.png");
|
||||||
this.Text = "Clocks";
|
this.Text = "Clocks";
|
||||||
break;
|
break;
|
||||||
|
case SensorType.Load:
|
||||||
|
this.Image = Utilities.EmbeddedResources.GetImage("load.png");
|
||||||
|
this.Text = "Load";
|
||||||
|
break;
|
||||||
case SensorType.Temperature:
|
case SensorType.Temperature:
|
||||||
this.Image = Utilities.EmbeddedResources.GetImage("temperature.png");
|
this.Image = Utilities.EmbeddedResources.GetImage("temperature.png");
|
||||||
this.Text = "Temperatures";
|
this.Text = "Temperatures";
|
||||||
|
@@ -53,6 +53,7 @@ namespace OpenHardwareMonitor.Hardware.ATI {
|
|||||||
private Sensor coreClock;
|
private Sensor coreClock;
|
||||||
private Sensor memoryClock;
|
private Sensor memoryClock;
|
||||||
private Sensor coreVoltage;
|
private Sensor coreVoltage;
|
||||||
|
private Sensor coreLoad;
|
||||||
|
|
||||||
private List<ISensor> active = new List<ISensor>();
|
private List<ISensor> active = new List<ISensor>();
|
||||||
|
|
||||||
@@ -74,6 +75,7 @@ namespace OpenHardwareMonitor.Hardware.ATI {
|
|||||||
this.coreClock = new Sensor("GPU Core", 0, SensorType.Clock, this);
|
this.coreClock = new Sensor("GPU Core", 0, SensorType.Clock, this);
|
||||||
this.memoryClock = new Sensor("GPU Memory", 1, SensorType.Clock, this);
|
this.memoryClock = new Sensor("GPU Memory", 1, SensorType.Clock, this);
|
||||||
this.coreVoltage = new Sensor("GPU Core", 0, SensorType.Voltage, this);
|
this.coreVoltage = new Sensor("GPU Core", 0, SensorType.Voltage, this);
|
||||||
|
this.coreLoad = new Sensor("GPU Core", 0, SensorType.Load, this);
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,13 +132,16 @@ namespace OpenHardwareMonitor.Hardware.ATI {
|
|||||||
coreClock.Value = 0.01f * adlp.EngineClock;
|
coreClock.Value = 0.01f * adlp.EngineClock;
|
||||||
memoryClock.Value = 0.01f * adlp.MemoryClock;
|
memoryClock.Value = 0.01f * adlp.MemoryClock;
|
||||||
coreVoltage.Value = 0.001f * adlp.Vddc;
|
coreVoltage.Value = 0.001f * adlp.Vddc;
|
||||||
|
coreLoad.Value = adlp.ActivityPercent;
|
||||||
ActivateSensor(coreClock);
|
ActivateSensor(coreClock);
|
||||||
ActivateSensor(memoryClock);
|
ActivateSensor(memoryClock);
|
||||||
ActivateSensor(coreVoltage);
|
ActivateSensor(coreVoltage);
|
||||||
|
ActivateSensor(coreLoad);
|
||||||
} else {
|
} else {
|
||||||
DeactivateSensor(coreClock);
|
DeactivateSensor(coreClock);
|
||||||
DeactivateSensor(memoryClock);
|
DeactivateSensor(memoryClock);
|
||||||
DeactivateSensor(coreVoltage);
|
DeactivateSensor(coreVoltage);
|
||||||
|
DeactivateSensor(coreLoad);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -38,6 +38,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
|
|
||||||
@@ -50,9 +51,16 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
|||||||
private uint pciAddress;
|
private uint pciAddress;
|
||||||
|
|
||||||
private Sensor[] coreTemperatures;
|
private Sensor[] coreTemperatures;
|
||||||
|
|
||||||
private float offset;
|
private float offset;
|
||||||
|
|
||||||
|
private Sensor totalLoad;
|
||||||
|
private Sensor[] coreLoads;
|
||||||
|
|
||||||
|
private List<ISensor> active = new List<ISensor>();
|
||||||
|
|
||||||
|
private PerformanceCounter totalLoadCounter;
|
||||||
|
private PerformanceCounter[] coreLoadCounters;
|
||||||
|
|
||||||
private const ushort PCI_AMD_VENDOR_ID = 0x1022;
|
private const ushort PCI_AMD_VENDOR_ID = 0x1022;
|
||||||
private const ushort PCI_AMD_0FH_MISCELLANEOUS_DEVICE_ID = 0x1103;
|
private const ushort PCI_AMD_0FH_MISCELLANEOUS_DEVICE_ID = 0x1103;
|
||||||
private const uint THERMTRIP_STATUS_REGISTER = 0xE4;
|
private const uint THERMTRIP_STATUS_REGISTER = 0xE4;
|
||||||
@@ -72,6 +80,23 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
|||||||
// max two cores
|
// max two cores
|
||||||
coreCount = coreCount > 2 ? 2 : coreCount;
|
coreCount = coreCount > 2 ? 2 : coreCount;
|
||||||
|
|
||||||
|
totalLoadCounter = new PerformanceCounter();
|
||||||
|
totalLoadCounter.CategoryName = "Processor";
|
||||||
|
totalLoadCounter.CounterName = "% Processor Time";
|
||||||
|
totalLoadCounter.InstanceName = "_Total";
|
||||||
|
totalLoad = new Sensor("CPU Total", 0, SensorType.Load, this);
|
||||||
|
|
||||||
|
coreLoadCounters = new PerformanceCounter[coreCount];
|
||||||
|
coreLoads = new Sensor[coreCount];
|
||||||
|
for (int i = 0; i < coreLoadCounters.Length; i++) {
|
||||||
|
coreLoadCounters[i] = new PerformanceCounter();
|
||||||
|
coreLoadCounters[i].CategoryName = "Processor";
|
||||||
|
coreLoadCounters[i].CounterName = "% Processor Time";
|
||||||
|
coreLoadCounters[i].InstanceName = i.ToString();
|
||||||
|
coreLoads[i] = new Sensor("Core #" + (i + 1), i + 1,
|
||||||
|
SensorType.Load, this);
|
||||||
|
}
|
||||||
|
|
||||||
coreTemperatures = new Sensor[coreCount];
|
coreTemperatures = new Sensor[coreCount];
|
||||||
for (int i = 0; i < coreCount; i++)
|
for (int i = 0; i < coreCount; i++)
|
||||||
coreTemperatures[i] =
|
coreTemperatures[i] =
|
||||||
@@ -102,9 +127,7 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ISensor[] Sensors {
|
public ISensor[] Sensors {
|
||||||
get {
|
get { return active.ToArray(); }
|
||||||
return coreTemperatures;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetReport() {
|
public string GetReport() {
|
||||||
@@ -121,16 +144,42 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
|||||||
i > 0 ? THERM_SENSE_CORE_SEL_CPU1 : THERM_SENSE_CORE_SEL_CPU0)) {
|
i > 0 ? THERM_SENSE_CORE_SEL_CPU1 : THERM_SENSE_CORE_SEL_CPU0)) {
|
||||||
uint value;
|
uint value;
|
||||||
if (WinRing0.ReadPciConfigDwordEx(
|
if (WinRing0.ReadPciConfigDwordEx(
|
||||||
pciAddress, THERMTRIP_STATUS_REGISTER, out value))
|
pciAddress, THERMTRIP_STATUS_REGISTER, out value)) {
|
||||||
coreTemperatures[i].Value = ((value >> 16) & 0xFF) + offset;
|
coreTemperatures[i].Value = ((value >> 16) & 0xFF) + offset;
|
||||||
|
ActivateSensor(coreTemperatures[i]);
|
||||||
|
} else {
|
||||||
|
DeactivateSensor(coreTemperatures[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
totalLoad.Value = totalLoadCounter.NextValue();
|
||||||
|
ActivateSensor(totalLoad);
|
||||||
|
|
||||||
|
for (int i = 0; i < coreLoads.Length; i++) {
|
||||||
|
coreLoads[i].Value = coreLoadCounters[i].NextValue();
|
||||||
|
ActivateSensor(coreLoads[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ActivateSensor(Sensor sensor) {
|
||||||
|
if (!active.Contains(sensor)) {
|
||||||
|
active.Add(sensor);
|
||||||
|
if (SensorAdded != null)
|
||||||
|
SensorAdded(sensor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DeactivateSensor(Sensor sensor) {
|
||||||
|
if (active.Contains(sensor)) {
|
||||||
|
active.Remove(sensor);
|
||||||
|
if (SensorRemoved != null)
|
||||||
|
SensorRemoved(sensor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable 67
|
|
||||||
public event SensorEventHandler SensorAdded;
|
public event SensorEventHandler SensorAdded;
|
||||||
public event SensorEventHandler SensorRemoved;
|
public event SensorEventHandler SensorRemoved;
|
||||||
#pragma warning restore 67
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -38,6 +38,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace OpenHardwareMonitor.Hardware.CPU {
|
namespace OpenHardwareMonitor.Hardware.CPU {
|
||||||
@@ -49,6 +50,13 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
|||||||
private uint pciAddress;
|
private uint pciAddress;
|
||||||
|
|
||||||
private Sensor coreTemperature;
|
private Sensor coreTemperature;
|
||||||
|
private Sensor totalLoad;
|
||||||
|
private Sensor[] coreLoads;
|
||||||
|
|
||||||
|
private List<ISensor> active = new List<ISensor>();
|
||||||
|
|
||||||
|
private PerformanceCounter totalLoadCounter;
|
||||||
|
private PerformanceCounter[] coreLoadCounters;
|
||||||
|
|
||||||
private const ushort PCI_AMD_VENDOR_ID = 0x1022;
|
private const ushort PCI_AMD_VENDOR_ID = 0x1022;
|
||||||
private const ushort PCI_AMD_10H_MISCELLANEOUS_DEVICE_ID = 0x1203;
|
private const ushort PCI_AMD_10H_MISCELLANEOUS_DEVICE_ID = 0x1203;
|
||||||
@@ -63,6 +71,23 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
|||||||
uint coreCount = 1;
|
uint coreCount = 1;
|
||||||
if (cpuidExtData.GetLength(0) > 8)
|
if (cpuidExtData.GetLength(0) > 8)
|
||||||
coreCount = (cpuidExtData[8, 2] & 0xFF) + 1;
|
coreCount = (cpuidExtData[8, 2] & 0xFF) + 1;
|
||||||
|
|
||||||
|
totalLoadCounter = new PerformanceCounter();
|
||||||
|
totalLoadCounter.CategoryName = "Processor";
|
||||||
|
totalLoadCounter.CounterName = "% Processor Time";
|
||||||
|
totalLoadCounter.InstanceName = "_Total";
|
||||||
|
totalLoad = new Sensor("CPU Total", 0, SensorType.Load, this);
|
||||||
|
|
||||||
|
coreLoadCounters = new PerformanceCounter[coreCount];
|
||||||
|
coreLoads = new Sensor[coreCount];
|
||||||
|
for (int i = 0; i < coreLoadCounters.Length; i++) {
|
||||||
|
coreLoadCounters[i] = new PerformanceCounter();
|
||||||
|
coreLoadCounters[i].CategoryName = "Processor";
|
||||||
|
coreLoadCounters[i].CounterName = "% Processor Time";
|
||||||
|
coreLoadCounters[i].InstanceName = i.ToString();
|
||||||
|
coreLoads[i] = new Sensor("Core #" + (i + 1), i + 1,
|
||||||
|
SensorType.Load, this);
|
||||||
|
}
|
||||||
|
|
||||||
// AMD family 10h processors support only one temperature sensor
|
// AMD family 10h processors support only one temperature sensor
|
||||||
coreTemperature = new Sensor(
|
coreTemperature = new Sensor(
|
||||||
@@ -87,9 +112,7 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ISensor[] Sensors {
|
public ISensor[] Sensors {
|
||||||
get {
|
get { return active.ToArray(); }
|
||||||
return new ISensor[] { coreTemperature };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetReport() {
|
public string GetReport() {
|
||||||
@@ -102,14 +125,40 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
|||||||
|
|
||||||
uint value;
|
uint value;
|
||||||
if (WinRing0.ReadPciConfigDwordEx(pciAddress,
|
if (WinRing0.ReadPciConfigDwordEx(pciAddress,
|
||||||
REPORTED_TEMPERATURE_CONTROL_REGISTER, out value))
|
REPORTED_TEMPERATURE_CONTROL_REGISTER, out value)) {
|
||||||
coreTemperature.Value = ((value >> 21) & 0x7FF) / 8.0f;
|
coreTemperature.Value = ((value >> 21) & 0x7FF) / 8.0f;
|
||||||
|
ActivateSensor(coreTemperature);
|
||||||
|
} else {
|
||||||
|
DeactivateSensor(coreTemperature);
|
||||||
|
}
|
||||||
|
|
||||||
|
totalLoad.Value = totalLoadCounter.NextValue();
|
||||||
|
ActivateSensor(totalLoad);
|
||||||
|
|
||||||
|
for (int i = 0; i < coreLoads.Length; i++) {
|
||||||
|
coreLoads[i].Value = coreLoadCounters[i].NextValue();
|
||||||
|
ActivateSensor(coreLoads[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ActivateSensor(Sensor sensor) {
|
||||||
|
if (!active.Contains(sensor)) {
|
||||||
|
active.Add(sensor);
|
||||||
|
if (SensorAdded != null)
|
||||||
|
SensorAdded(sensor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DeactivateSensor(Sensor sensor) {
|
||||||
|
if (active.Contains(sensor)) {
|
||||||
|
active.Remove(sensor);
|
||||||
|
if (SensorRemoved != null)
|
||||||
|
SensorRemoved(sensor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable 67
|
|
||||||
public event SensorEventHandler SensorAdded;
|
public event SensorEventHandler SensorAdded;
|
||||||
public event SensorEventHandler SensorRemoved;
|
public event SensorEventHandler SensorRemoved;
|
||||||
#pragma warning restore 67
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -38,6 +38,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
@@ -48,12 +49,19 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
|||||||
private Image icon;
|
private Image icon;
|
||||||
|
|
||||||
private Sensor[] coreTemperatures;
|
private Sensor[] coreTemperatures;
|
||||||
|
private Sensor totalLoad;
|
||||||
|
private Sensor[] coreLoads;
|
||||||
|
|
||||||
|
private List<ISensor> active = new List<ISensor>();
|
||||||
|
|
||||||
private float tjMax = 0;
|
private float tjMax = 0;
|
||||||
private uint logicalProcessors;
|
private uint logicalProcessors;
|
||||||
private uint logicalProcessorsPerCore;
|
private uint logicalProcessorsPerCore;
|
||||||
private uint coreCount;
|
private uint coreCount;
|
||||||
|
|
||||||
|
private PerformanceCounter totalLoadCounter;
|
||||||
|
private PerformanceCounter[] coreLoadCounters;
|
||||||
|
|
||||||
private const uint IA32_THERM_STATUS_MSR = 0x019C;
|
private const uint IA32_THERM_STATUS_MSR = 0x019C;
|
||||||
private const uint IA32_TEMPERATURE_TARGET = 0x01A2;
|
private const uint IA32_TEMPERATURE_TARGET = 0x01A2;
|
||||||
|
|
||||||
@@ -125,11 +133,29 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
|||||||
default: tjMax = 100; break;
|
default: tjMax = 100; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
totalLoadCounter = new PerformanceCounter();
|
||||||
|
totalLoadCounter.CategoryName = "Processor";
|
||||||
|
totalLoadCounter.CounterName = "% Processor Time";
|
||||||
|
totalLoadCounter.InstanceName = "_Total";
|
||||||
|
totalLoad = new Sensor("CPU Total", 0, SensorType.Load, this);
|
||||||
|
|
||||||
|
coreLoadCounters = new PerformanceCounter[
|
||||||
|
coreCount * logicalProcessorsPerCore];
|
||||||
|
for (int i = 0; i < coreLoadCounters.Length; i++) {
|
||||||
|
coreLoadCounters[i] = new PerformanceCounter();
|
||||||
|
coreLoadCounters[i].CategoryName = "Processor";
|
||||||
|
coreLoadCounters[i].CounterName = "% Processor Time";
|
||||||
|
coreLoadCounters[i].InstanceName = i.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
coreTemperatures = new Sensor[coreCount];
|
coreTemperatures = new Sensor[coreCount];
|
||||||
for (int i = 0; i < coreTemperatures.Length; i++)
|
coreLoads = new Sensor[coreCount];
|
||||||
coreTemperatures[i] =
|
for (int i = 0; i < coreTemperatures.Length; i++) {
|
||||||
new Sensor("Core #" + (i + 1), i, tjMax, SensorType.Temperature,
|
coreTemperatures[i] = new Sensor("Core #" + (i + 1), i, tjMax,
|
||||||
this);
|
SensorType.Temperature, this);
|
||||||
|
coreLoads[i] = new Sensor("Core #" + (i + 1), i + 1,
|
||||||
|
SensorType.Load, this);
|
||||||
|
}
|
||||||
|
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
@@ -147,9 +173,7 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ISensor[] Sensors {
|
public ISensor[] Sensors {
|
||||||
get {
|
get { return active.ToArray(); }
|
||||||
return coreTemperatures;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetReport() {
|
public string GetReport() {
|
||||||
@@ -180,14 +204,44 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
|||||||
if ((eax & 0x80000000) != 0) {
|
if ((eax & 0x80000000) != 0) {
|
||||||
// get the dist from tjMax from bits 22:16
|
// get the dist from tjMax from bits 22:16
|
||||||
coreTemperatures[i].Value = tjMax - ((eax & 0x007F0000) >> 16);
|
coreTemperatures[i].Value = tjMax - ((eax & 0x007F0000) >> 16);
|
||||||
|
ActivateSensor(coreTemperatures[i]);
|
||||||
|
} else {
|
||||||
|
DeactivateSensor(coreTemperatures[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
totalLoad.Value = totalLoadCounter.NextValue();
|
||||||
|
ActivateSensor(totalLoad);
|
||||||
|
|
||||||
|
for (int i = 0; i < coreLoads.Length; i++) {
|
||||||
|
float value = 0;
|
||||||
|
for (int j = 0; j < logicalProcessorsPerCore; j++)
|
||||||
|
value += coreLoadCounters[
|
||||||
|
logicalProcessorsPerCore * i + j].NextValue();
|
||||||
|
value /= logicalProcessorsPerCore;
|
||||||
|
coreLoads[i].Value = value;
|
||||||
|
ActivateSensor(coreLoads[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ActivateSensor(Sensor sensor) {
|
||||||
|
if (!active.Contains(sensor)) {
|
||||||
|
active.Add(sensor);
|
||||||
|
if (SensorAdded != null)
|
||||||
|
SensorAdded(sensor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DeactivateSensor(Sensor sensor) {
|
||||||
|
if (active.Contains(sensor)) {
|
||||||
|
active.Remove(sensor);
|
||||||
|
if (SensorRemoved != null)
|
||||||
|
SensorRemoved(sensor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable 67
|
|
||||||
public event SensorEventHandler SensorAdded;
|
public event SensorEventHandler SensorAdded;
|
||||||
public event SensorEventHandler SensorRemoved;
|
public event SensorEventHandler SensorRemoved;
|
||||||
#pragma warning restore 67
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -42,8 +42,9 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
|
|
||||||
public enum SensorType {
|
public enum SensorType {
|
||||||
Voltage,
|
Voltage,
|
||||||
Clock,
|
Clock,
|
||||||
Temperature,
|
Temperature,
|
||||||
|
Load,
|
||||||
Fan
|
Fan
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>{F5E0C1F7-9E9B-46F2-AC88-8C9C1C923880}</ProjectGuid>
|
<ProjectGuid>{F5E0C1F7-9E9B-46F2-AC88-8C9C1C923880}</ProjectGuid>
|
||||||
<ProductVersion>9.0.21022</ProductVersion>
|
<ProductVersion>9.0.30729</ProductVersion>
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<NoStandardLibraries>false</NoStandardLibraries>
|
<NoStandardLibraries>false</NoStandardLibraries>
|
||||||
@@ -135,6 +135,7 @@
|
|||||||
<EmbeddedResource Include="Resources\chip.png" />
|
<EmbeddedResource Include="Resources\chip.png" />
|
||||||
<EmbeddedResource Include="Resources\hdd.png" />
|
<EmbeddedResource Include="Resources\hdd.png" />
|
||||||
<Content Include="Resources\icon.ico" />
|
<Content Include="Resources\icon.ico" />
|
||||||
|
<EmbeddedResource Include="Resources\load.png" />
|
||||||
<EmbeddedResource Include="Resources\voltage.png" />
|
<EmbeddedResource Include="Resources\voltage.png" />
|
||||||
<EmbeddedResource Include="Resources\nvidia.png" />
|
<EmbeddedResource Include="Resources\nvidia.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@@ -69,5 +69,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("0.1.10.0")]
|
[assembly: AssemblyVersion("0.1.11.0")]
|
||||||
[assembly: AssemblyFileVersion("0.1.10.0")]
|
[assembly: AssemblyFileVersion("0.1.11.0")]
|
||||||
|
BIN
Resources/load.png
Normal file
BIN
Resources/load.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 278 B |
Reference in New Issue
Block a user