Skip to content

Instantly share code, notes, and snippets.

@peazz
Created August 15, 2021 18:21
Show Gist options
  • Save peazz/843f6c7692a5b9ad87d0c6f0cfcbf737 to your computer and use it in GitHub Desktop.
Save peazz/843f6c7692a5b9ad87d0c6f0cfcbf737 to your computer and use it in GitHub Desktop.
OHM Step 6
// Targets AMD & Nvidia GPUS
if (hardware.HardwareType == HardwareType.GpuAti || hardware.HardwareType == HardwareType.GpuNvidia)
{
// 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("GPU Core"))
{
// store
gpuTemp = sensor.Value.GetValueOrDefault();
// print to console
System.Diagnostics.Debug.WriteLine("gpuTemp: " + sensor.Value.GetValueOrDefault());
}
else if (sensor.SensorType == SensorType.Load && sensor.Name.Contains("GPU Core"))
{
// store
gpuUsage = sensor.Value.GetValueOrDefault();
// print to console
System.Diagnostics.Debug.WriteLine("gpuUsage: " + sensor.Value.GetValueOrDefault());
}
else if (sensor.SensorType == SensorType.Clock && sensor.Name.Contains("GPU Core"))
{
// store
gpuCoreFrequency = sensor.Value.GetValueOrDefault();
// print to console
System.Diagnostics.Debug.WriteLine("gpuCoreFrequency: " + sensor.Value.GetValueOrDefault());
}
else if (sensor.SensorType == SensorType.Clock && sensor.Name.Contains("GPU Memory"))
{
// store
gpuMemoryFrequency = sensor.Value.GetValueOrDefault();
// print to console
System.Diagnostics.Debug.WriteLine("gpuMemoryFrequency: " + sensor.Value.GetValueOrDefault());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment