2010-01-26 22:37:48 +00:00
|
|
|
/*
|
|
|
|
|
2012-05-27 14:23:31 +00:00
|
|
|
This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2010-01-26 22:37:48 +00:00
|
|
|
|
2020-02-11 22:44:30 +01:00
|
|
|
Copyright (C) 2009-2020 Michael Möller <mmoeller@openhardwaremonitor.org>
|
2012-05-27 14:23:31 +00:00
|
|
|
|
2010-01-26 22:37:48 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
using System;
|
2010-08-12 20:53:27 +00:00
|
|
|
using System.Globalization;
|
2020-02-27 22:48:26 +01:00
|
|
|
using System.Text;
|
2010-01-26 22:37:48 +00:00
|
|
|
|
|
|
|
namespace OpenHardwareMonitor.Hardware.ATI {
|
2010-08-12 20:53:27 +00:00
|
|
|
internal sealed class ATIGPU : Hardware {
|
2010-01-26 22:37:48 +00:00
|
|
|
|
2010-09-21 20:32:36 +00:00
|
|
|
private readonly int adapterIndex;
|
|
|
|
private readonly int busNumber;
|
|
|
|
private readonly int deviceNumber;
|
2020-02-11 22:44:30 +01:00
|
|
|
private readonly Sensor temperatureCore;
|
|
|
|
private readonly Sensor temperatureMemory;
|
|
|
|
private readonly Sensor temperatureVrmCore;
|
|
|
|
private readonly Sensor temperatureVrmMemory;
|
2020-03-01 22:36:10 +01:00
|
|
|
private readonly Sensor temperatureVrmMemory0;
|
|
|
|
private readonly Sensor temperatureVrmMemory1;
|
2020-02-11 22:44:30 +01:00
|
|
|
private readonly Sensor temperatureLiquid;
|
|
|
|
private readonly Sensor temperaturePlx;
|
|
|
|
private readonly Sensor temperatureHotSpot;
|
2020-03-01 22:36:10 +01:00
|
|
|
private readonly Sensor temperatureVrmSoc;
|
2020-02-11 22:44:30 +01:00
|
|
|
private readonly Sensor powerCore;
|
|
|
|
private readonly Sensor powerPpt;
|
|
|
|
private readonly Sensor powerSocket;
|
|
|
|
private readonly Sensor powerTotal;
|
2020-03-01 22:36:10 +01:00
|
|
|
private readonly Sensor powerSoc;
|
2010-09-21 20:32:36 +00:00
|
|
|
private readonly Sensor fan;
|
|
|
|
private readonly Sensor coreClock;
|
|
|
|
private readonly Sensor memoryClock;
|
2020-03-01 22:36:10 +01:00
|
|
|
private readonly Sensor socClock;
|
2010-09-21 20:32:36 +00:00
|
|
|
private readonly Sensor coreVoltage;
|
2020-02-28 23:21:02 +01:00
|
|
|
private readonly Sensor memoryVoltage;
|
2020-03-01 22:36:10 +01:00
|
|
|
private readonly Sensor socVoltage;
|
2010-09-21 20:32:36 +00:00
|
|
|
private readonly Sensor coreLoad;
|
2020-03-01 22:36:10 +01:00
|
|
|
private readonly Sensor memoryLoad;
|
2011-01-20 21:31:54 +00:00
|
|
|
private readonly Sensor controlSensor;
|
2020-02-11 22:44:30 +01:00
|
|
|
private readonly Control fanControl;
|
|
|
|
|
|
|
|
private IntPtr context;
|
|
|
|
private readonly int overdriveVersion;
|
2010-01-26 22:37:48 +00:00
|
|
|
|
2010-01-27 19:30:10 +00:00
|
|
|
public ATIGPU(string name, int adapterIndex, int busNumber,
|
2020-02-11 22:44:30 +01:00
|
|
|
int deviceNumber, IntPtr context, ISettings settings)
|
2011-04-30 16:03:58 +00:00
|
|
|
: base(name, new Identifier("atigpu",
|
|
|
|
adapterIndex.ToString(CultureInfo.InvariantCulture)), settings)
|
2010-01-27 19:30:10 +00:00
|
|
|
{
|
2010-01-26 22:37:48 +00:00
|
|
|
this.adapterIndex = adapterIndex;
|
2010-01-27 19:30:10 +00:00
|
|
|
this.busNumber = busNumber;
|
|
|
|
this.deviceNumber = deviceNumber;
|
2010-01-26 22:37:48 +00:00
|
|
|
|
2020-02-11 22:44:30 +01:00
|
|
|
this.context = context;
|
|
|
|
|
|
|
|
if (ADL.ADL_Overdrive_Caps(adapterIndex, out _, out _,
|
2020-03-09 23:45:35 +01:00
|
|
|
out overdriveVersion) != ADLStatus.OK)
|
2020-02-11 22:44:30 +01:00
|
|
|
{
|
|
|
|
overdriveVersion = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.temperatureCore =
|
|
|
|
new Sensor("GPU Core", 0, SensorType.Temperature, this, settings);
|
|
|
|
this.temperatureMemory =
|
|
|
|
new Sensor("GPU Memory", 1, SensorType.Temperature, this, settings);
|
|
|
|
this.temperatureVrmCore =
|
|
|
|
new Sensor("GPU VRM Core", 2, SensorType.Temperature, this, settings);
|
|
|
|
this.temperatureVrmMemory =
|
|
|
|
new Sensor("GPU VRM Memory", 3, SensorType.Temperature, this, settings);
|
2020-03-01 22:36:10 +01:00
|
|
|
this.temperatureVrmMemory0 =
|
|
|
|
new Sensor("GPU VRM Memory #1", 4, SensorType.Temperature, this, settings);
|
|
|
|
this.temperatureVrmMemory1 =
|
|
|
|
new Sensor("GPU VRM Memory #2", 5, SensorType.Temperature, this, settings);
|
|
|
|
this.temperatureVrmSoc =
|
|
|
|
new Sensor("GPU VRM SOC", 6, SensorType.Temperature, this, settings);
|
|
|
|
this.temperatureLiquid =
|
|
|
|
new Sensor("GPU Liquid", 7, SensorType.Temperature, this, settings);
|
2020-02-11 22:44:30 +01:00
|
|
|
this.temperaturePlx =
|
2020-03-01 22:36:10 +01:00
|
|
|
new Sensor("GPU PLX", 8, SensorType.Temperature, this, settings);
|
2020-02-11 22:44:30 +01:00
|
|
|
this.temperatureHotSpot =
|
2020-03-01 22:36:10 +01:00
|
|
|
new Sensor("GPU Hot Spot", 9, SensorType.Temperature, this, settings);
|
2020-02-11 22:44:30 +01:00
|
|
|
|
|
|
|
this.powerTotal = new Sensor("GPU Total", 0, SensorType.Power, this, settings);
|
|
|
|
this.powerCore = new Sensor("GPU Core", 1, SensorType.Power, this, settings);
|
|
|
|
this.powerPpt = new Sensor("GPU PPT", 2, SensorType.Power, this, settings);
|
|
|
|
this.powerSocket = new Sensor("GPU Socket", 3, SensorType.Power, this, settings);
|
2020-03-01 22:36:10 +01:00
|
|
|
this.powerSoc = new Sensor("GPU SOC", 4, SensorType.Power, this, settings);
|
2020-02-11 22:44:30 +01:00
|
|
|
|
2010-08-08 13:57:26 +00:00
|
|
|
this.fan = new Sensor("GPU Fan", 0, SensorType.Fan, this, settings);
|
2020-03-01 22:36:10 +01:00
|
|
|
|
2010-08-08 13:57:26 +00:00
|
|
|
this.coreClock = new Sensor("GPU Core", 0, SensorType.Clock, this, settings);
|
|
|
|
this.memoryClock = new Sensor("GPU Memory", 1, SensorType.Clock, this, settings);
|
2020-03-01 22:36:10 +01:00
|
|
|
this.socClock = new Sensor("GPU SOC", 2, SensorType.Clock, this, settings);
|
|
|
|
|
2010-08-08 13:57:26 +00:00
|
|
|
this.coreVoltage = new Sensor("GPU Core", 0, SensorType.Voltage, this, settings);
|
2020-02-28 23:21:02 +01:00
|
|
|
this.memoryVoltage = new Sensor("GPU Memory", 1, SensorType.Voltage, this, settings);
|
2020-03-01 22:36:10 +01:00
|
|
|
this.socVoltage = new Sensor("GPU SOC", 2, SensorType.Voltage, this, settings);
|
|
|
|
|
2010-08-08 13:57:26 +00:00
|
|
|
this.coreLoad = new Sensor("GPU Core", 0, SensorType.Load, this, settings);
|
2020-03-01 22:36:10 +01:00
|
|
|
this.memoryLoad = new Sensor("GPU Memory", 1, SensorType.Load, this, settings);
|
|
|
|
|
2011-01-20 21:31:54 +00:00
|
|
|
this.controlSensor = new Sensor("GPU Fan", 0, SensorType.Control, this, settings);
|
|
|
|
|
|
|
|
ADLFanSpeedInfo afsi = new ADLFanSpeedInfo();
|
|
|
|
if (ADL.ADL_Overdrive5_FanSpeedInfo_Get(adapterIndex, 0, ref afsi)
|
2020-03-09 23:45:35 +01:00
|
|
|
!= ADLStatus.OK)
|
2011-01-20 21:31:54 +00:00
|
|
|
{
|
|
|
|
afsi.MaxPercent = 100;
|
|
|
|
afsi.MinPercent = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.fanControl = new Control(controlSensor, settings, afsi.MinPercent,
|
|
|
|
afsi.MaxPercent);
|
|
|
|
this.fanControl.ControlModeChanged += ControlModeChanged;
|
|
|
|
this.fanControl.SoftwareControlValueChanged +=
|
|
|
|
SoftwareControlValueChanged;
|
|
|
|
ControlModeChanged(fanControl);
|
|
|
|
this.controlSensor.Control = fanControl;
|
2010-01-26 22:37:48 +00:00
|
|
|
Update();
|
|
|
|
}
|
|
|
|
|
2011-01-20 21:31:54 +00:00
|
|
|
private void SoftwareControlValueChanged(IControl control) {
|
2014-12-30 16:02:52 +00:00
|
|
|
if (control.ControlMode == ControlMode.Software) {
|
2011-01-20 21:31:54 +00:00
|
|
|
ADLFanSpeedValue adlf = new ADLFanSpeedValue();
|
|
|
|
adlf.SpeedType = ADL.ADL_DL_FANCTRL_SPEED_TYPE_PERCENT;
|
|
|
|
adlf.Flags = ADL.ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED;
|
|
|
|
adlf.FanSpeed = (int)control.SoftwareValue;
|
|
|
|
ADL.ADL_Overdrive5_FanSpeed_Set(adapterIndex, 0, ref adlf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void ControlModeChanged(IControl control) {
|
2014-12-30 16:02:52 +00:00
|
|
|
switch (control.ControlMode) {
|
|
|
|
case ControlMode.Undefined:
|
|
|
|
return;
|
|
|
|
case ControlMode.Default:
|
|
|
|
SetDefaultFanSpeed();
|
|
|
|
break;
|
|
|
|
case ControlMode.Software:
|
|
|
|
SoftwareControlValueChanged(control);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
2011-01-20 21:31:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-30 16:02:52 +00:00
|
|
|
private void SetDefaultFanSpeed() {
|
|
|
|
ADL.ADL_Overdrive5_FanSpeedToDefault_Set(adapterIndex, 0);
|
|
|
|
}
|
|
|
|
|
2010-01-27 19:30:10 +00:00
|
|
|
public int BusNumber { get { return busNumber; } }
|
|
|
|
|
|
|
|
public int DeviceNumber { get { return deviceNumber; } }
|
|
|
|
|
2010-01-26 22:37:48 +00:00
|
|
|
|
2010-08-08 13:57:26 +00:00
|
|
|
public override HardwareType HardwareType {
|
2010-09-06 19:53:13 +00:00
|
|
|
get { return HardwareType.GpuAti; }
|
2010-01-26 22:37:48 +00:00
|
|
|
}
|
|
|
|
|
2020-02-11 22:44:30 +01:00
|
|
|
private void GetODNTemperature(ADLODNTemperatureType type,
|
|
|
|
Sensor sensor)
|
|
|
|
{
|
|
|
|
if (ADL.ADL2_OverdriveN_Temperature_Get(context, adapterIndex,
|
2020-03-09 23:45:35 +01:00
|
|
|
type, out int temperature) == ADLStatus.OK)
|
2010-01-31 22:00:31 +00:00
|
|
|
{
|
2020-02-11 22:44:30 +01:00
|
|
|
sensor.Value = 0.001f * temperature;
|
|
|
|
ActivateSensor(sensor);
|
2010-01-31 22:00:31 +00:00
|
|
|
} else {
|
2020-02-11 22:44:30 +01:00
|
|
|
sensor.Value = null;
|
2010-01-31 22:00:31 +00:00
|
|
|
}
|
2020-02-11 22:44:30 +01:00
|
|
|
}
|
2010-01-26 22:37:48 +00:00
|
|
|
|
2020-02-11 22:44:30 +01:00
|
|
|
private void GetOD6Power(ADLODNCurrentPowerType type, Sensor sensor)
|
|
|
|
{
|
|
|
|
if (ADL.ADL2_Overdrive6_CurrentPower_Get(context, adapterIndex, type,
|
2020-03-09 23:45:35 +01:00
|
|
|
out int power) == ADLStatus.OK)
|
2020-02-11 22:44:30 +01:00
|
|
|
{
|
|
|
|
sensor.Value = power * (1.0f / 0xFF);
|
|
|
|
ActivateSensor(sensor);
|
|
|
|
} else {
|
|
|
|
sensor.Value = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-02-27 22:48:26 +01:00
|
|
|
public override string GetReport() {
|
|
|
|
var r = new StringBuilder();
|
|
|
|
|
|
|
|
r.AppendLine("AMD GPU");
|
|
|
|
r.AppendLine();
|
|
|
|
|
|
|
|
r.Append("AdapterIndex: ");
|
|
|
|
r.AppendLine(adapterIndex.ToString(CultureInfo.InvariantCulture));
|
|
|
|
r.AppendLine();
|
|
|
|
|
2020-03-08 22:58:53 +01:00
|
|
|
r.AppendLine("Overdrive Caps");
|
2020-02-27 22:48:26 +01:00
|
|
|
r.AppendLine();
|
2020-03-08 22:58:53 +01:00
|
|
|
try {
|
2020-03-09 23:45:35 +01:00
|
|
|
var status = ADL.ADL_Overdrive_Caps(adapterIndex,
|
2020-03-08 22:58:53 +01:00
|
|
|
out int supported, out int enabled, out int version);
|
|
|
|
r.Append(" Status: ");
|
2020-03-09 23:45:35 +01:00
|
|
|
r.AppendLine(status.ToString());
|
2020-03-08 22:58:53 +01:00
|
|
|
r.Append(" Supported: ");
|
|
|
|
r.AppendLine(supported.ToString(CultureInfo.InvariantCulture));
|
|
|
|
r.Append(" Enabled: ");
|
|
|
|
r.AppendLine(enabled.ToString(CultureInfo.InvariantCulture));
|
|
|
|
r.Append(" Version: ");
|
|
|
|
r.AppendLine(version.ToString(CultureInfo.InvariantCulture));
|
|
|
|
} catch (Exception e) {
|
|
|
|
r.AppendLine(" Status: " + e.Message);
|
|
|
|
}
|
|
|
|
r.AppendLine();
|
|
|
|
|
2020-03-09 23:45:35 +01:00
|
|
|
r.AppendLine("Overdrive5 Parameters");
|
|
|
|
r.AppendLine();
|
|
|
|
try {
|
|
|
|
var status = ADL.ADL_Overdrive5_ODParameters_Get(
|
|
|
|
adapterIndex, out var p);
|
|
|
|
r.Append(" Status: ");
|
|
|
|
r.AppendLine(status.ToString());
|
|
|
|
r.AppendFormat(" NumberOfPerformanceLevels: {0}{1}",
|
|
|
|
p.NumberOfPerformanceLevels, Environment.NewLine);
|
|
|
|
r.AppendFormat(" ActivityReportingSupported: {0}{1}",
|
|
|
|
p.ActivityReportingSupported, Environment.NewLine);
|
|
|
|
r.AppendFormat(" DiscretePerformanceLevels: {0}{1}",
|
|
|
|
p.DiscretePerformanceLevels, Environment.NewLine);
|
|
|
|
r.AppendFormat(" EngineClock.Min: {0}{1}",
|
|
|
|
p.EngineClock.Min, Environment.NewLine);
|
|
|
|
r.AppendFormat(" EngineClock.Max: {0}{1}",
|
|
|
|
p.EngineClock.Max, Environment.NewLine);
|
|
|
|
r.AppendFormat(" EngineClock.Step: {0}{1}",
|
|
|
|
p.EngineClock.Step, Environment.NewLine);
|
|
|
|
r.AppendFormat(" MemoryClock.Min: {0}{1}",
|
|
|
|
p.MemoryClock.Min, Environment.NewLine);
|
|
|
|
r.AppendFormat(" MemoryClock.Max: {0}{1}",
|
|
|
|
p.MemoryClock.Max, Environment.NewLine);
|
|
|
|
r.AppendFormat(" MemoryClock.Step: {0}{1}",
|
|
|
|
p.MemoryClock.Step, Environment.NewLine);
|
|
|
|
r.AppendFormat(" Vddc.Min: {0}{1}",
|
|
|
|
p.Vddc.Min, Environment.NewLine);
|
|
|
|
r.AppendFormat(" Vddc.Max: {0}{1}",
|
|
|
|
p.Vddc.Max, Environment.NewLine);
|
|
|
|
r.AppendFormat(" Vddc.Step: {0}{1}",
|
|
|
|
p.Vddc.Step, Environment.NewLine);
|
|
|
|
} catch (Exception e) {
|
|
|
|
r.AppendLine(" Status: " + e.Message);
|
|
|
|
}
|
|
|
|
r.AppendLine();
|
|
|
|
|
2020-03-08 22:58:53 +01:00
|
|
|
r.AppendLine("Overdrive5 Temperature");
|
|
|
|
r.AppendLine();
|
|
|
|
try {
|
|
|
|
var adlt = new ADLTemperature();
|
|
|
|
var status = ADL.ADL_Overdrive5_Temperature_Get(adapterIndex, 0,
|
|
|
|
ref adlt);
|
|
|
|
r.Append(" Status: ");
|
2020-03-09 23:45:35 +01:00
|
|
|
r.AppendLine(status.ToString());
|
2020-03-08 22:58:53 +01:00
|
|
|
r.AppendFormat(" Value: {0}{1}",
|
|
|
|
0.001f * adlt.Temperature, Environment.NewLine);
|
|
|
|
} catch (Exception e) {
|
|
|
|
r.AppendLine(" Status: " + e.Message);
|
|
|
|
}
|
|
|
|
r.AppendLine();
|
|
|
|
|
|
|
|
r.AppendLine("Overdrive5 FanSpeed");
|
|
|
|
r.AppendLine();
|
|
|
|
try {
|
|
|
|
var adlf = new ADLFanSpeedValue();
|
|
|
|
adlf.SpeedType = ADL.ADL_DL_FANCTRL_SPEED_TYPE_RPM;
|
|
|
|
var status = ADL.ADL_Overdrive5_FanSpeed_Get(adapterIndex, 0, ref adlf);
|
|
|
|
r.Append(" Status RPM: ");
|
2020-03-09 23:45:35 +01:00
|
|
|
r.AppendLine(status.ToString());
|
2020-03-08 22:58:53 +01:00
|
|
|
r.AppendFormat(" Value RPM: {0}{1}",
|
|
|
|
adlf.FanSpeed, Environment.NewLine);
|
|
|
|
adlf.SpeedType = ADL.ADL_DL_FANCTRL_SPEED_TYPE_PERCENT;
|
|
|
|
status = ADL.ADL_Overdrive5_FanSpeed_Get(adapterIndex, 0, ref adlf);
|
|
|
|
r.Append(" Status Percent: ");
|
2020-03-09 23:45:35 +01:00
|
|
|
r.AppendLine(status.ToString());
|
2020-03-08 22:58:53 +01:00
|
|
|
r.AppendFormat(" Value Percent: {0}{1}",
|
|
|
|
adlf.FanSpeed, Environment.NewLine);
|
|
|
|
} catch (Exception e) {
|
|
|
|
r.AppendLine(" Status: " + e.Message);
|
|
|
|
}
|
2020-02-27 22:48:26 +01:00
|
|
|
r.AppendLine();
|
|
|
|
|
2020-03-08 22:58:53 +01:00
|
|
|
r.AppendLine("Overdrive5 CurrentActivity");
|
|
|
|
r.AppendLine();
|
|
|
|
try {
|
|
|
|
var adlp = new ADLPMActivity();
|
|
|
|
var status = ADL.ADL_Overdrive5_CurrentActivity_Get(adapterIndex,
|
|
|
|
ref adlp);
|
|
|
|
r.Append(" Status: ");
|
2020-03-09 23:45:35 +01:00
|
|
|
r.AppendLine(status.ToString());
|
2020-03-08 22:58:53 +01:00
|
|
|
r.AppendFormat(" EngineClock: {0}{1}",
|
|
|
|
0.01f * adlp.EngineClock, Environment.NewLine);
|
|
|
|
r.AppendFormat(" MemoryClock: {0}{1}",
|
|
|
|
0.01f * adlp.MemoryClock, Environment.NewLine);
|
|
|
|
r.AppendFormat(" Vddc: {0}{1}",
|
|
|
|
0.001f * adlp.Vddc, Environment.NewLine);
|
|
|
|
r.AppendFormat(" ActivityPercent: {0}{1}",
|
|
|
|
adlp.ActivityPercent, Environment.NewLine);
|
|
|
|
r.AppendFormat(" CurrentPerformanceLevel: {0}{1}",
|
|
|
|
adlp.CurrentPerformanceLevel, Environment.NewLine);
|
|
|
|
r.AppendFormat(" CurrentBusSpeed: {0}{1}",
|
|
|
|
adlp.CurrentBusSpeed, Environment.NewLine);
|
|
|
|
r.AppendFormat(" CurrentBusLanes: {0}{1}",
|
|
|
|
adlp.CurrentBusLanes, Environment.NewLine);
|
|
|
|
r.AppendFormat(" MaximumBusLanes: {0}{1}",
|
|
|
|
adlp.MaximumBusLanes, Environment.NewLine);
|
|
|
|
} catch (Exception e) {
|
|
|
|
r.AppendLine(" Status: " + e.Message);
|
|
|
|
}
|
|
|
|
r.AppendLine();
|
|
|
|
|
|
|
|
if (context != IntPtr.Zero) {
|
|
|
|
r.AppendLine("Overdrive6 CurrentPower");
|
2020-02-28 23:21:02 +01:00
|
|
|
r.AppendLine();
|
2020-03-08 22:58:53 +01:00
|
|
|
try {
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
var pt = ((ADLODNCurrentPowerType)i).ToString();
|
|
|
|
var status = ADL.ADL2_Overdrive6_CurrentPower_Get(
|
|
|
|
context, adapterIndex, (ADLODNCurrentPowerType)i,
|
|
|
|
out int power);
|
2020-03-09 23:45:35 +01:00
|
|
|
if (status == ADLStatus.OK) {
|
2020-03-08 22:58:53 +01:00
|
|
|
r.AppendFormat(" Power[{0}].Value: {1}{2}", pt,
|
|
|
|
power * (1.0f / 0xFF), Environment.NewLine);
|
|
|
|
} else {
|
|
|
|
r.AppendFormat(" Power[{0}].Status: {1}{2}", pt,
|
2020-03-09 23:45:35 +01:00
|
|
|
status.ToString(), Environment.NewLine);
|
2020-03-08 22:58:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (EntryPointNotFoundException) {
|
|
|
|
r.AppendLine(" Status: Entry point not found");
|
|
|
|
} catch (Exception e) {
|
|
|
|
r.AppendLine(" Status: " + e.Message);
|
2020-02-28 23:21:02 +01:00
|
|
|
}
|
|
|
|
r.AppendLine();
|
|
|
|
}
|
2020-02-27 22:48:26 +01:00
|
|
|
|
2020-03-08 22:58:53 +01:00
|
|
|
if (context != IntPtr.Zero) {
|
|
|
|
r.AppendLine("OverdriveN Temperature");
|
2020-02-28 23:21:02 +01:00
|
|
|
r.AppendLine();
|
2020-03-08 22:58:53 +01:00
|
|
|
try {
|
|
|
|
for (int i = 1; i < 8; i++) {
|
|
|
|
var tt = ((ADLODNTemperatureType)i).ToString();
|
|
|
|
var status = ADL.ADL2_OverdriveN_Temperature_Get(
|
|
|
|
context, adapterIndex, (ADLODNTemperatureType)i,
|
|
|
|
out int temperature);
|
2020-03-09 23:45:35 +01:00
|
|
|
if (status == ADLStatus.OK) {
|
2020-03-08 22:58:53 +01:00
|
|
|
r.AppendFormat(" Temperature[{0}].Value: {1}{2}", tt,
|
|
|
|
0.001f * temperature, Environment.NewLine);
|
|
|
|
} else {
|
|
|
|
r.AppendFormat(" Temperature[{0}].Status: {1}{2}", tt,
|
2020-03-09 23:45:35 +01:00
|
|
|
status.ToString(), Environment.NewLine);
|
2020-03-08 22:58:53 +01:00
|
|
|
}
|
2020-02-28 23:21:02 +01:00
|
|
|
}
|
2020-03-08 22:58:53 +01:00
|
|
|
} catch (EntryPointNotFoundException) {
|
|
|
|
r.AppendLine(" Status: Entry point not found");
|
|
|
|
} catch (Exception e) {
|
|
|
|
r.AppendLine(" Status: " + e.Message);
|
2020-02-11 22:44:30 +01:00
|
|
|
}
|
2020-02-28 23:21:02 +01:00
|
|
|
r.AppendLine();
|
2020-02-11 22:44:30 +01:00
|
|
|
}
|
|
|
|
|
2020-03-09 23:45:35 +01:00
|
|
|
if (context != IntPtr.Zero) {
|
|
|
|
r.AppendLine("OverdriveN Performance Status");
|
|
|
|
r.AppendLine();
|
|
|
|
try {
|
|
|
|
var status = ADL.ADL2_OverdriveN_PerformanceStatus_Get(context,
|
|
|
|
adapterIndex, out var ps);
|
|
|
|
r.Append(" Status: ");
|
|
|
|
r.AppendLine(status.ToString());
|
|
|
|
r.AppendFormat(" CoreClock: {0}{1}",
|
|
|
|
ps.CoreClock, Environment.NewLine);
|
|
|
|
r.AppendFormat(" MemoryClock: {0}{1}",
|
|
|
|
ps.MemoryClock, Environment.NewLine);
|
|
|
|
r.AppendFormat(" DCEFClock: {0}{1}",
|
|
|
|
ps.DCEFClock, Environment.NewLine);
|
|
|
|
r.AppendFormat(" GFXClock: {0}{1}",
|
|
|
|
ps.GFXClock, Environment.NewLine);
|
|
|
|
r.AppendFormat(" UVDClock: {0}{1}",
|
|
|
|
ps.UVDClock, Environment.NewLine);
|
|
|
|
r.AppendFormat(" VCEClock: {0}{1}",
|
|
|
|
ps.VCEClock, Environment.NewLine);
|
|
|
|
r.AppendFormat(" GPUActivityPercent: {0}{1}",
|
|
|
|
ps.GPUActivityPercent, Environment.NewLine);
|
|
|
|
r.AppendFormat(" CurrentCorePerformanceLevel: {0}{1}",
|
|
|
|
ps.CurrentCorePerformanceLevel, Environment.NewLine);
|
|
|
|
r.AppendFormat(" CurrentMemoryPerformanceLevel: {0}{1}",
|
|
|
|
ps.CurrentMemoryPerformanceLevel, Environment.NewLine);
|
|
|
|
r.AppendFormat(" CurrentDCEFPerformanceLevel: {0}{1}",
|
|
|
|
ps.CurrentDCEFPerformanceLevel, Environment.NewLine);
|
|
|
|
r.AppendFormat(" CurrentGFXPerformanceLevel: {0}{1}",
|
|
|
|
ps.CurrentGFXPerformanceLevel, Environment.NewLine);
|
|
|
|
r.AppendFormat(" UVDPerformanceLevel: {0}{1}",
|
|
|
|
ps.UVDPerformanceLevel, Environment.NewLine);
|
|
|
|
r.AppendFormat(" VCEPerformanceLevel: {0}{1}",
|
|
|
|
ps.VCEPerformanceLevel, Environment.NewLine);
|
|
|
|
r.AppendFormat(" CurrentBusSpeed: {0}{1}",
|
|
|
|
ps.CurrentBusSpeed, Environment.NewLine);
|
|
|
|
r.AppendFormat(" CurrentBusLanes: {0}{1}",
|
|
|
|
ps.CurrentBusLanes, Environment.NewLine);
|
|
|
|
r.AppendFormat(" MaximumBusLanes: {0}{1}",
|
|
|
|
ps.MaximumBusLanes, Environment.NewLine);
|
|
|
|
r.AppendFormat(" VDDC: {0}{1}",
|
|
|
|
ps.VDDC, Environment.NewLine);
|
|
|
|
r.AppendFormat(" VDDCI: {0}{1}",
|
|
|
|
ps.VDDCI, Environment.NewLine);
|
|
|
|
} catch (EntryPointNotFoundException) {
|
|
|
|
r.AppendLine(" Status: Entry point not found");
|
|
|
|
} catch (Exception e) {
|
|
|
|
r.AppendLine(" Status: " + e.Message);
|
|
|
|
}
|
|
|
|
r.AppendLine();
|
|
|
|
}
|
|
|
|
|
2020-03-08 22:58:53 +01:00
|
|
|
if (context != IntPtr.Zero) {
|
|
|
|
r.AppendLine("Performance Metrics");
|
2020-02-28 23:21:02 +01:00
|
|
|
r.AppendLine();
|
2020-03-08 22:58:53 +01:00
|
|
|
try {
|
|
|
|
var status = ADL.ADL2_New_QueryPMLogData_Get(context, adapterIndex,
|
|
|
|
out var data);
|
2020-03-09 23:45:35 +01:00
|
|
|
if (status == ADLStatus.OK) {
|
2020-03-08 22:58:53 +01:00
|
|
|
for (int i = 0; i < data.Sensors.Length; i++) {
|
|
|
|
if (data.Sensors[i].Supported) {
|
|
|
|
var st = ((ADLSensorType)i).ToString();
|
|
|
|
r.AppendFormat(" Sensor[{0}].Value: {1}{2}", st,
|
|
|
|
data.Sensors[i].Value, Environment.NewLine);
|
|
|
|
}
|
2020-02-29 10:14:25 +01:00
|
|
|
}
|
2020-03-08 22:58:53 +01:00
|
|
|
} else {
|
|
|
|
r.Append(" Status: ");
|
2020-03-09 23:45:35 +01:00
|
|
|
r.AppendLine(status.ToString());
|
2020-02-28 23:21:02 +01:00
|
|
|
}
|
2020-03-08 22:58:53 +01:00
|
|
|
} catch (EntryPointNotFoundException) {
|
|
|
|
r.AppendLine(" Status: Entry point not found");
|
|
|
|
} catch (Exception e) {
|
|
|
|
r.AppendLine(" Status: " + e.Message);
|
|
|
|
}
|
|
|
|
|
2020-02-28 23:21:02 +01:00
|
|
|
r.AppendLine();
|
2010-08-05 19:28:50 +00:00
|
|
|
}
|
|
|
|
|
2020-02-28 23:21:02 +01:00
|
|
|
return r.ToString();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void GetPMLog(ADLPMLogDataOutput data,
|
|
|
|
ADLSensorType sensorType, Sensor sensor, float factor = 1.0f)
|
|
|
|
{
|
|
|
|
int i = (int)sensorType;
|
2020-02-29 10:14:25 +01:00
|
|
|
if (i < data.Sensors.Length && data.Sensors[i].Supported) {
|
2020-02-28 23:21:02 +01:00
|
|
|
sensor.Value = data.Sensors[i].Value * factor;
|
|
|
|
ActivateSensor(sensor);
|
2010-01-31 22:00:31 +00:00
|
|
|
}
|
2020-02-28 23:21:02 +01:00
|
|
|
}
|
2010-01-26 22:37:48 +00:00
|
|
|
|
2020-02-28 23:21:02 +01:00
|
|
|
public override void Update() {
|
|
|
|
if (context != IntPtr.Zero && overdriveVersion >= 8 &&
|
|
|
|
ADL.ADL2_New_QueryPMLogData_Get(context, adapterIndex,
|
2020-03-09 23:45:35 +01:00
|
|
|
out var data) == ADLStatus.OK)
|
2010-01-31 22:00:31 +00:00
|
|
|
{
|
2020-02-28 23:21:02 +01:00
|
|
|
GetPMLog(data, ADLSensorType.TEMPERATURE_EDGE, temperatureCore);
|
|
|
|
GetPMLog(data, ADLSensorType.TEMPERATURE_MEM, temperatureMemory);
|
|
|
|
GetPMLog(data, ADLSensorType.TEMPERATURE_VRVDDC, temperatureVrmCore);
|
|
|
|
GetPMLog(data, ADLSensorType.TEMPERATURE_VRMVDD, temperatureVrmMemory);
|
2020-03-01 22:36:10 +01:00
|
|
|
GetPMLog(data, ADLSensorType.TEMPERATURE_VRMVDD0, temperatureVrmMemory0);
|
|
|
|
GetPMLog(data, ADLSensorType.TEMPERATURE_VRMVDD1, temperatureVrmMemory1);
|
|
|
|
GetPMLog(data, ADLSensorType.TEMPERATURE_VRSOC, temperatureVrmSoc);
|
2020-02-28 23:21:02 +01:00
|
|
|
GetPMLog(data, ADLSensorType.TEMPERATURE_LIQUID, temperatureLiquid);
|
|
|
|
GetPMLog(data, ADLSensorType.TEMPERATURE_PLX, temperaturePlx);
|
|
|
|
GetPMLog(data, ADLSensorType.TEMPERATURE_HOTSPOT, temperatureHotSpot);
|
|
|
|
GetPMLog(data, ADLSensorType.GFX_POWER, powerCore);
|
|
|
|
GetPMLog(data, ADLSensorType.ASIC_POWER, powerTotal);
|
2020-03-01 22:36:10 +01:00
|
|
|
GetPMLog(data, ADLSensorType.SOC_POWER, powerSoc);
|
2020-02-28 23:21:02 +01:00
|
|
|
GetPMLog(data, ADLSensorType.FAN_RPM, fan);
|
|
|
|
GetPMLog(data, ADLSensorType.CLK_GFXCLK, coreClock);
|
2020-03-01 22:36:10 +01:00
|
|
|
GetPMLog(data, ADLSensorType.CLK_MEMCLK, memoryClock);
|
|
|
|
GetPMLog(data, ADLSensorType.CLK_SOCCLK, socClock);
|
2020-02-28 23:21:02 +01:00
|
|
|
GetPMLog(data, ADLSensorType.GFX_VOLTAGE, coreVoltage, 0.001f);
|
|
|
|
GetPMLog(data, ADLSensorType.MEM_VOLTAGE, memoryVoltage, 0.001f);
|
2020-03-01 22:36:10 +01:00
|
|
|
GetPMLog(data, ADLSensorType.SOC_VOLTAGE, socVoltage, 0.001f);
|
2020-02-28 23:21:02 +01:00
|
|
|
GetPMLog(data, ADLSensorType.INFO_ACTIVITY_GFX, coreLoad);
|
2020-03-01 22:36:10 +01:00
|
|
|
GetPMLog(data, ADLSensorType.INFO_ACTIVITY_MEM, memoryLoad);
|
2020-02-28 23:21:02 +01:00
|
|
|
GetPMLog(data, ADLSensorType.FAN_PERCENTAGE, controlSensor);
|
|
|
|
} else {
|
|
|
|
if (context != IntPtr.Zero && overdriveVersion >= 7) {
|
|
|
|
GetODNTemperature(ADLODNTemperatureType.CORE, temperatureCore);
|
|
|
|
GetODNTemperature(ADLODNTemperatureType.MEMORY, temperatureMemory);
|
|
|
|
GetODNTemperature(ADLODNTemperatureType.VRM_CORE, temperatureVrmCore);
|
|
|
|
GetODNTemperature(ADLODNTemperatureType.VRM_MEMORY, temperatureVrmMemory);
|
|
|
|
GetODNTemperature(ADLODNTemperatureType.LIQUID, temperatureLiquid);
|
|
|
|
GetODNTemperature(ADLODNTemperatureType.PLX, temperaturePlx);
|
|
|
|
GetODNTemperature(ADLODNTemperatureType.HOTSPOT, temperatureHotSpot);
|
2011-04-15 23:52:07 +00:00
|
|
|
} else {
|
2020-02-28 23:21:02 +01:00
|
|
|
ADLTemperature adlt = new ADLTemperature();
|
|
|
|
if (ADL.ADL_Overdrive5_Temperature_Get(adapterIndex, 0, ref adlt)
|
2020-03-09 23:45:35 +01:00
|
|
|
== ADLStatus.OK)
|
2020-03-08 22:58:53 +01:00
|
|
|
{
|
2020-02-28 23:21:02 +01:00
|
|
|
temperatureCore.Value = 0.001f * adlt.Temperature;
|
|
|
|
ActivateSensor(temperatureCore);
|
|
|
|
} else {
|
|
|
|
temperatureCore.Value = null;
|
|
|
|
}
|
2010-03-10 17:56:08 +00:00
|
|
|
}
|
|
|
|
|
2020-02-28 23:21:02 +01:00
|
|
|
if (context != IntPtr.Zero && overdriveVersion >= 6) {
|
|
|
|
GetOD6Power(ADLODNCurrentPowerType.TOTAL_POWER, powerTotal);
|
|
|
|
GetOD6Power(ADLODNCurrentPowerType.CHIP_POWER, powerCore);
|
|
|
|
GetOD6Power(ADLODNCurrentPowerType.PPT_POWER, powerPpt);
|
|
|
|
GetOD6Power(ADLODNCurrentPowerType.SOCKET_POWER, powerSocket);
|
|
|
|
}
|
|
|
|
|
|
|
|
ADLFanSpeedValue adlf = new ADLFanSpeedValue();
|
|
|
|
adlf.SpeedType = ADL.ADL_DL_FANCTRL_SPEED_TYPE_RPM;
|
|
|
|
if (ADL.ADL_Overdrive5_FanSpeed_Get(adapterIndex, 0, ref adlf)
|
2020-03-09 23:45:35 +01:00
|
|
|
== ADLStatus.OK)
|
2020-03-08 22:58:53 +01:00
|
|
|
{
|
2020-02-28 23:21:02 +01:00
|
|
|
fan.Value = adlf.FanSpeed;
|
|
|
|
ActivateSensor(fan);
|
2011-04-15 23:52:07 +00:00
|
|
|
} else {
|
2020-02-28 23:21:02 +01:00
|
|
|
fan.Value = null;
|
2010-03-10 17:56:08 +00:00
|
|
|
}
|
|
|
|
|
2020-02-28 23:21:02 +01:00
|
|
|
adlf = new ADLFanSpeedValue();
|
|
|
|
adlf.SpeedType = ADL.ADL_DL_FANCTRL_SPEED_TYPE_PERCENT;
|
|
|
|
if (ADL.ADL_Overdrive5_FanSpeed_Get(adapterIndex, 0, ref adlf)
|
2020-03-09 23:45:35 +01:00
|
|
|
== ADLStatus.OK)
|
2020-03-08 22:58:53 +01:00
|
|
|
{
|
2020-02-28 23:21:02 +01:00
|
|
|
controlSensor.Value = adlf.FanSpeed;
|
|
|
|
ActivateSensor(controlSensor);
|
2011-04-15 23:52:07 +00:00
|
|
|
} else {
|
2020-02-28 23:21:02 +01:00
|
|
|
controlSensor.Value = null;
|
2010-03-10 17:56:08 +00:00
|
|
|
}
|
|
|
|
|
2020-02-28 23:21:02 +01:00
|
|
|
ADLPMActivity adlp = new ADLPMActivity();
|
|
|
|
if (ADL.ADL_Overdrive5_CurrentActivity_Get(adapterIndex, ref adlp)
|
2020-03-09 23:45:35 +01:00
|
|
|
== ADLStatus.OK)
|
2020-03-08 22:58:53 +01:00
|
|
|
{
|
2020-02-28 23:21:02 +01:00
|
|
|
if (adlp.EngineClock > 0) {
|
|
|
|
coreClock.Value = 0.01f * adlp.EngineClock;
|
|
|
|
ActivateSensor(coreClock);
|
|
|
|
} else {
|
|
|
|
coreClock.Value = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (adlp.MemoryClock > 0) {
|
|
|
|
memoryClock.Value = 0.01f * adlp.MemoryClock;
|
|
|
|
ActivateSensor(memoryClock);
|
|
|
|
} else {
|
|
|
|
memoryClock.Value = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (adlp.Vddc > 0) {
|
|
|
|
coreVoltage.Value = 0.001f * adlp.Vddc;
|
|
|
|
ActivateSensor(coreVoltage);
|
|
|
|
} else {
|
|
|
|
coreVoltage.Value = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
coreLoad.Value = Math.Min(adlp.ActivityPercent, 100);
|
|
|
|
ActivateSensor(coreLoad);
|
|
|
|
} else {
|
|
|
|
coreClock.Value = null;
|
|
|
|
memoryClock.Value = null;
|
|
|
|
coreVoltage.Value = null;
|
|
|
|
coreLoad.Value = null;
|
|
|
|
}
|
2010-01-31 22:00:31 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-20 21:31:54 +00:00
|
|
|
|
2011-06-19 12:41:18 +00:00
|
|
|
public override void Close() {
|
2011-01-20 21:31:54 +00:00
|
|
|
this.fanControl.ControlModeChanged -= ControlModeChanged;
|
|
|
|
this.fanControl.SoftwareControlValueChanged -=
|
|
|
|
SoftwareControlValueChanged;
|
|
|
|
|
2014-12-30 16:02:52 +00:00
|
|
|
if (this.fanControl.ControlMode != ControlMode.Undefined)
|
|
|
|
SetDefaultFanSpeed();
|
2011-06-19 12:41:18 +00:00
|
|
|
base.Close();
|
2011-01-20 21:31:54 +00:00
|
|
|
}
|
2010-01-26 22:37:48 +00:00
|
|
|
}
|
|
|
|
}
|