Created
August 15, 2021 18:20
-
-
Save peazz/af550d98189bd5971cbb35a320656b5b to your computer and use it in GitHub Desktop.
OHM Step 5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (hardware.HardwareType == HardwareType.CPU) | |
{ | |
// only fire the update when found | |
hardware.Update(); | |
// loop through the data | |
foreach (var sensor in hardware.Sensors) | |
if (sensor.SensorType == SensorType.Temperature && sensor.Name.Contains("CPU Package")) | |
{ | |
// store | |
cpuTemp = sensor.Value.GetValueOrDefault(); | |
// print to console | |
System.Diagnostics.Debug.WriteLine("cpuTemp: " + sensor.Value.GetValueOrDefault()); | |
} | |
else if (sensor.SensorType == SensorType.Load && sensor.Name.Contains("CPU Total")) | |
{ | |
// store | |
cpuUsage = sensor.Value.GetValueOrDefault(); | |
// print to console | |
System.Diagnostics.Debug.WriteLine("cpuUsage: " + sensor.Value.GetValueOrDefault()); | |
} | |
else if (sensor.SensorType == SensorType.Power && sensor.Name.Contains("CPU Package")) | |
{ | |
// store | |
cpuPowerDrawPackage = sensor.Value.GetValueOrDefault(); | |
// print to console | |
System.Diagnostics.Debug.WriteLine("CPU Power Draw - Package: " + sensor.Value.GetValueOrDefault()); | |
} | |
else if (sensor.SensorType == SensorType.Clock && sensor.Name.Contains("CPU Core #1")) | |
{ | |
// store | |
cpuFrequency = sensor.Value.GetValueOrDefault(); | |
// print to console | |
System.Diagnostics.Debug.WriteLine("cpuFrequency: " + sensor.Value.GetValueOrDefault()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment