示例#1
0
 public void Close()
 {
     try
     {
         foreach (var gpu in hardware)
         {
             gpu.Close();
         }
         ADL.ADL_Main_Control_Destroy();
     }
     catch (Exception)
     {
     }
 }
示例#2
0
 private void GetODNTemperature(ADLODNTemperatureType type,
                                Sensor sensor)
 {
     if (ADL.ADL2_OverdriveN_Temperature_Get(context, adapterIndex,
                                             type, out int temperature) == ADL.ADL_OK)
     {
         sensor.Value = 0.001f * temperature;
         ActivateSensor(sensor);
     }
     else
     {
         sensor.Value = null;
     }
 }
示例#3
0
 private void RestoreDefaultFanSpeed()
 {
     if (restoreDefaultFanSpeedRequired)
     {
         ADL.ADL_Overdrive5_FanSpeed_Set(adapterIndex, 0,
                                         ref this.initialFanSpeedValue);
         if ((initialFanSpeedValue.Flags &
              ADL.ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED) == 0)
         {
             ADL.ADL_Overdrive5_FanSpeedToDefault_Set(adapterIndex, 0);
         }
         restoreDefaultFanSpeedRequired = false;
     }
 }
示例#4
0
        private void GetOD6Power(ADLODNCurrentPowerType type, Sensor sensor)
        {
            bool eval = sensorConfig.GetSensorEvaluate(sensor.IdentifierString);

            if (eval && (ADL.ADL2_Overdrive6_CurrentPower_Get(context, adapterIndex, type,
                                                              out int power) == ADL.ADL_OK))
            {
                sensor.Value = power * (1.0f / 0xFF);
                ActivateSensor(sensor);
            }
            else
            {
                sensor.Value = null;
            }
        }
示例#5
0
        public void Close()
        {
            try {
                foreach (ATIGPU gpu in hardware)
                {
                    gpu.Close();
                }

                if (context != IntPtr.Zero)
                {
                    ADL.ADL2_Main_Control_Destroy(context);
                    context = IntPtr.Zero;
                }

                ADL.ADL_Main_Control_Destroy();
            } catch (Exception) { }
        }
示例#6
0
        public ATIGPU(string name, int adapterIndex, int busNumber,
                      int deviceNumber)
        {
            this.name         = name;
            this.icon         = Utilities.EmbeddedResources.GetImage("ati.png");
            this.adapterIndex = adapterIndex;
            this.busNumber    = busNumber;
            this.deviceNumber = deviceNumber;

            ADLFanSpeedInfo speedInfo = new ADLFanSpeedInfo();

            ADL.ADL_Overdrive5_FanSpeedInfo_Get(adapterIndex, 0, ref speedInfo);

            this.temperature =
                new Sensor("GPU Core", 0, SensorType.Temperature, this);
            this.fan         = new Sensor("GPU", 0, speedInfo.MaxRPM, SensorType.Fan, this);
            this.coreClock   = new Sensor("GPU Core", 0, SensorType.Clock, this);
            this.memoryClock = new Sensor("GPU Memory", 1, SensorType.Clock, this);
            this.coreVoltage = new Sensor("GPU Core", 0, SensorType.Voltage, this);
            this.coreLoad    = new Sensor("GPU Core", 0, SensorType.Load, this);
            Update();
        }
示例#7
0
 public void Close()
 {
     try {
         ADL.ADL_Main_Control_Destroy();
     } catch (Exception) { }
 }
示例#8
0
        public override void Update()
        {
            ADLTemperature adlt = new ADLTemperature();

            if (ADL.ADL_Overdrive5_Temperature_Get(adapterIndex, 0, ref adlt)
                == ADL.ADL_OK)
            {
                temperature.Value = 0.001f * adlt.Temperature;
                ActivateSensor(temperature);
            }
            else
            {
                DeactivateSensor(temperature);
            }

            ADLFanSpeedValue adlf = new ADLFanSpeedValue();

            adlf.SpeedType = ADL.ADL_DL_FANCTRL_SPEED_TYPE_RPM;
            if (ADL.ADL_Overdrive5_FanSpeed_Get(adapterIndex, 0, ref adlf)
                == ADL.ADL_OK)
            {
                fan.Value = adlf.FanSpeed;
                ActivateSensor(fan);
            }
            else
            {
                DeactivateSensor(fan);
            }

            ADLPMActivity adlp = new ADLPMActivity();

            if (ADL.ADL_Overdrive5_CurrentActivity_Get(adapterIndex, ref adlp)
                == ADL.ADL_OK)
            {
                if (adlp.EngineClock > 0)
                {
                    coreClock.Value = 0.01f * adlp.EngineClock;
                    ActivateSensor(coreClock);
                }

                if (adlp.MemoryClock > 0)
                {
                    memoryClock.Value = 0.01f * adlp.MemoryClock;
                    ActivateSensor(memoryClock);
                }

                if (adlp.Vddc > 0)
                {
                    coreVoltage.Value = 0.001f * adlp.Vddc;
                    ActivateSensor(coreVoltage);
                }

                coreLoad.Value = Math.Min(adlp.ActivityPercent, 100);
                ActivateSensor(coreLoad);
            }
            else
            {
                DeactivateSensor(coreClock);
                DeactivateSensor(memoryClock);
                DeactivateSensor(coreVoltage);
                DeactivateSensor(coreLoad);
            }
        }
示例#9
0
        public override void Update()
        {
            if (context != IntPtr.Zero && overdriveVersion >= 8 &&
                ADL.ADL2_New_QueryPMLogData_Get(context, adapterIndex,
                                                out var data) == ADLStatus.OK)
            {
                GetPMLog(data, ADLSensorType.TEMPERATURE_EDGE, temperatureCore);
                GetPMLog(data, ADLSensorType.TEMPERATURE_MEM, temperatureMemory);
                GetPMLog(data, ADLSensorType.TEMPERATURE_VRVDDC, temperatureVrmCore);
                GetPMLog(data, ADLSensorType.TEMPERATURE_VRMVDD, temperatureVrmMemory);
                GetPMLog(data, ADLSensorType.TEMPERATURE_VRMVDD0, temperatureVrmMemory0);
                GetPMLog(data, ADLSensorType.TEMPERATURE_VRMVDD1, temperatureVrmMemory1);
                GetPMLog(data, ADLSensorType.TEMPERATURE_VRSOC, temperatureVrmSoc);
                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);
                GetPMLog(data, ADLSensorType.SOC_POWER, powerSoc);
                GetPMLog(data, ADLSensorType.FAN_RPM, fan);
                GetPMLog(data, ADLSensorType.CLK_GFXCLK, coreClock);
                GetPMLog(data, ADLSensorType.CLK_MEMCLK, memoryClock);
                GetPMLog(data, ADLSensorType.CLK_SOCCLK, socClock);
                GetPMLog(data, ADLSensorType.GFX_VOLTAGE, coreVoltage, 0.001f);
                GetPMLog(data, ADLSensorType.MEM_VOLTAGE, memoryVoltage, 0.001f);
                GetPMLog(data, ADLSensorType.SOC_VOLTAGE, socVoltage, 0.001f);
                GetPMLog(data, ADLSensorType.INFO_ACTIVITY_GFX, coreLoad);
                GetPMLog(data, ADLSensorType.INFO_ACTIVITY_MEM, memoryLoad);
                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);
                }
                else
                {
                    ADLTemperature adlt = new ADLTemperature();
                    if (ADL.ADL_Overdrive5_Temperature_Get(adapterIndex, 0, ref adlt)
                        == ADLStatus.OK)
                    {
                        temperatureCore.Value = 0.001f * adlt.Temperature;
                        ActivateSensor(temperatureCore);
                    }
                    else
                    {
                        temperatureCore.Value = null;
                    }
                }

                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)
                    == ADLStatus.OK)
                {
                    fan.Value = adlf.FanSpeed;
                    ActivateSensor(fan);
                }
                else
                {
                    fan.Value = null;
                }

                adlf           = new ADLFanSpeedValue();
                adlf.SpeedType = ADL.ADL_DL_FANCTRL_SPEED_TYPE_PERCENT;
                if (ADL.ADL_Overdrive5_FanSpeed_Get(adapterIndex, 0, ref adlf)
                    == ADLStatus.OK)
                {
                    controlSensor.Value = adlf.FanSpeed;
                    ActivateSensor(controlSensor);
                }
                else
                {
                    controlSensor.Value = null;
                }

                ADLPMActivity adlp = new ADLPMActivity();
                if (ADL.ADL_Overdrive5_CurrentActivity_Get(adapterIndex, ref adlp)
                    == ADLStatus.OK)
                {
                    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;
                    }

                    if (adlp.ActivityPercent >= 0 && adlp.ActivityPercent <= 100)
                    {
                        coreLoad.Value = adlp.ActivityPercent;
                        ActivateSensor(coreLoad);
                    }
                    else
                    {
                        coreLoad.Value = null;
                    }
                }
                else
                {
                    coreClock.Value   = null;
                    memoryClock.Value = null;
                    coreVoltage.Value = null;
                    coreLoad.Value    = null;
                }
            }
        }
示例#10
0
        public ATIGPU(string name, int adapterIndex, int busNumber,
                      int deviceNumber, IntPtr context, ISettings settings)
            : base(name, new Identifier("atigpu",
                                        adapterIndex.ToString(CultureInfo.InvariantCulture)), settings)
        {
            this.adapterIndex = adapterIndex;
            this.busNumber    = busNumber;
            this.deviceNumber = deviceNumber;

            this.context = context;

            if (ADL.ADL_Overdrive_Caps(adapterIndex, out _, out _,
                                       out overdriveVersion) != ADLStatus.OK)
            {
                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);
            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);
            this.temperaturePlx =
                new Sensor("GPU PLX", 8, SensorType.Temperature, this, settings);
            this.temperatureHotSpot =
                new Sensor("GPU Hot Spot", 9, SensorType.Temperature, this, settings);

            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);
            this.powerSoc    = new Sensor("GPU SOC", 4, SensorType.Power, this, settings);

            this.fan = new Sensor("GPU Fan", 0, SensorType.Fan, this, settings);

            this.coreClock   = new Sensor("GPU Core", 0, SensorType.Clock, this, settings);
            this.memoryClock = new Sensor("GPU Memory", 1, SensorType.Clock, this, settings);
            this.socClock    = new Sensor("GPU SOC", 2, SensorType.Clock, this, settings);

            this.coreVoltage   = new Sensor("GPU Core", 0, SensorType.Voltage, this, settings);
            this.memoryVoltage = new Sensor("GPU Memory", 1, SensorType.Voltage, this, settings);
            this.socVoltage    = new Sensor("GPU SOC", 2, SensorType.Voltage, this, settings);

            this.coreLoad   = new Sensor("GPU Core", 0, SensorType.Load, this, settings);
            this.memoryLoad = new Sensor("GPU Memory", 1, SensorType.Load, this, settings);

            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)
                != ADLStatus.OK)
            {
                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;
            Update();
        }
示例#11
0
 private void SetDefaultFanSpeed()
 {
     ADL.ADL_Overdrive6_FanSpeed_Reset(adapterIndex);
 }
示例#12
0
        public override void Update()
        {
            if (context != IntPtr.Zero && overdriveVersion >= 8 &&
                ADL.ADL2_New_QueryPMLogData_Get(context, adapterIndex,
                                                out var data) == ADL.ADL_OK)
            {
                GetPMLog(data, ADLSensorType.TEMPERATURE_EDGE, temperatureCore);
                GetPMLog(data, ADLSensorType.TEMPERATURE_MEM, temperatureMemory);
                GetPMLog(data, ADLSensorType.TEMPERATURE_VRVDDC, temperatureVrmCore);
                GetPMLog(data, ADLSensorType.TEMPERATURE_VRMVDD, temperatureVrmMemory);
                //GetPMLog(data, ADLSensorType.TEMPERATURE_VRMVDD0, temperatureVrmMemory0);
                //GetPMLog(data, ADLSensorType.TEMPERATURE_VRMVDD1, temperatureVrmMemory1);
                GetPMLog(data, ADLSensorType.TEMPERATURE_VRSOC, temperatureVrmSoc);
                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);
                GetPMLog(data, ADLSensorType.SOC_POWER, powerSoc);
                GetPMLog(data, ADLSensorType.FAN_RPM, fan);
                GetPMLog(data, ADLSensorType.CLK_GFXCLK, coreClock);
                GetPMLog(data, ADLSensorType.CLK_MEMCLK, memoryClock);
                GetPMLog(data, ADLSensorType.CLK_SOCCLK, socClock);
                GetPMLog(data, ADLSensorType.GFX_VOLTAGE, coreVoltage, 0.001f);
                GetPMLog(data, ADLSensorType.MEM_VOLTAGE, memoryVoltage, 0.001f);
                GetPMLog(data, ADLSensorType.SOC_VOLTAGE, socVoltage, 0.001f);
                GetPMLog(data, ADLSensorType.INFO_ACTIVITY_GFX, coreLoad);
                GetPMLog(data, ADLSensorType.INFO_ACTIVITY_MEM, memoryControllerLoad);
                GetPMLog(data, ADLSensorType.FAN_PERCENTAGE, controlSensor);

                if (sensorConfig.GetSensorEvaluate(this.memoryUsed.IdentifierString))
                {
                    if (ADL.ADL2_Adapter_VRAMUsage_Get(context, adapterIndex, out int vramUsage) == ADL.ADL_OK)
                    {
                        this.memoryUsed.Value = vramUsage / 1024f;
                        ActivateSensor(this.memoryUsed);
                    }
                }
            }
            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);
                }
                else
                {
                    ADLTemperature adlt = new ADLTemperature();
                    bool           evalTemperatureCore = sensorConfig.GetSensorEvaluate(temperatureCore.IdentifierString);
                    if (evalTemperatureCore && (ADL.ADL_Overdrive5_Temperature_Get(adapterIndex, 0, ref adlt)
                                                == ADL.ADL_OK))
                    {
                        temperatureCore.Value = 0.001f * adlt.Temperature;
                        ActivateSensor(temperatureCore);
                    }
                    else
                    {
                        temperatureCore.Value = null;
                    }
                }

                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
                {
                    SpeedType = ADL.ADL_DL_FANCTRL_SPEED_TYPE_RPM
                };

                bool evalFan = sensorConfig.GetSensorEvaluate(fan.IdentifierString);
                if (evalFan && (ADL.ADL_Overdrive5_FanSpeed_Get(adapterIndex, 0, ref adlf)
                                == ADL.ADL_OK))
                {
                    fan.Value = adlf.FanSpeed;
                    ActivateSensor(fan);
                }
                else
                {
                    fan.Value = null;
                }

                adlf = new ADLFanSpeedValue
                {
                    SpeedType = ADL.ADL_DL_FANCTRL_SPEED_TYPE_PERCENT
                };

                bool evalControlSensor = sensorConfig.GetSensorEvaluate(controlSensor.IdentifierString);
                if (evalControlSensor && (ADL.ADL_Overdrive5_FanSpeed_Get(adapterIndex, 0, ref adlf)
                                          == ADL.ADL_OK))
                {
                    // ADL bug: percentage is not 0 when rpm is 0
                    controlSensor.Value = fan.Value == 0 ? 0 : adlf.FanSpeed;
                    ActivateSensor(controlSensor);
                }
                else
                {
                    controlSensor.Value = null;
                }

                ADLPMActivity adlp = new ADLPMActivity();
                if (ADL.ADL_Overdrive5_CurrentActivity_Get(adapterIndex, ref adlp) == ADL.ADL_OK)
                {
                    bool evalCoreClock = sensorConfig.GetSensorEvaluate(coreClock.IdentifierString);
                    if (adlp.EngineClock > 0 && evalCoreClock)
                    {
                        coreClock.Value = 0.01f * adlp.EngineClock;
                        ActivateSensor(coreClock);
                    }
                    else
                    {
                        coreClock.Value = null;
                    }

                    bool evalMemoryClock = sensorConfig.GetSensorEvaluate(memoryClock.IdentifierString);
                    if (adlp.MemoryClock > 0 && evalMemoryClock)
                    {
                        memoryClock.Value = 0.01f * adlp.MemoryClock;
                        ActivateSensor(memoryClock);
                    }
                    else
                    {
                        memoryClock.Value = null;
                    }

                    bool evalCoreVoltage = sensorConfig.GetSensorEvaluate(coreVoltage.IdentifierString);
                    if (adlp.Vddc > 0 && evalCoreVoltage)
                    {
                        coreVoltage.Value = 0.001f * adlp.Vddc;
                        ActivateSensor(coreVoltage);
                    }
                    else
                    {
                        coreVoltage.Value = null;
                    }

                    if (sensorConfig.GetSensorEvaluate(coreLoad.IdentifierString))
                    {
                        coreLoad.Value = Math.Min(adlp.ActivityPercent, 100);
                        ActivateSensor(coreLoad);
                    }
                }
                else
                {
                    coreClock.Value   = null;
                    memoryClock.Value = null;
                    coreVoltage.Value = null;
                    coreLoad.Value    = null;
                }
            }

            // update VRAM usage
            if (dedicatedVramUsagePerformCounter != null)
            {
                try
                {
                    if (sensorConfig.GetSensorEvaluate(memoryUsageDedicated.IdentifierString))
                    {
                        memoryUsageDedicated.Value = dedicatedVramUsagePerformCounter.NextValue() / SCALE;
                        ActivateSensor(memoryUsageDedicated);
                    }
                    else
                    {
                        memoryUsageDedicated.Value = null;
                    }
                }
                catch { memoryUsageDedicated.Value = null; }
            }

            if (sharedVramUsagePerformCounter != null)
            {
                try
                {
                    if (sensorConfig.GetSensorEvaluate(memoryUsageShared.IdentifierString))
                    {
                        memoryUsageShared.Value = (float)sharedVramUsagePerformCounter.NextValue() / SCALE;
                        ActivateSensor(memoryUsageShared);
                    }
                    else
                    {
                        memoryUsageShared.Value = null;
                    }
                }
                catch { memoryUsageShared.Value = null; }
            }

            try
            {
                if (sensorConfig.GetSensorEvaluate(processMemoryUsageDedicated.IdentifierString))
                {
                    lock (_performanceCounterLock)
                    {
                        processMemoryUsageDedicated.Value = dedicatedVramUsageProcessPerformCounter == null
                        ? 0f : (float)dedicatedVramUsageProcessPerformCounter.NextValue() / SCALE;
                    }
                    ActivateSensor(processMemoryUsageDedicated);
                }
                else
                {
                    processMemoryUsageDedicated.Value = null;
                }
            }
            catch { processMemoryUsageDedicated.Value = null; }

            try
            {
                if (sensorConfig.GetSensorEvaluate(processMemoryUsageShared.IdentifierString))
                {
                    lock (_performanceCounterLock)
                    {
                        processMemoryUsageShared.Value = sharedVramUsageProcessPerformCounter == null
                        ? 0f : (float)sharedVramUsageProcessPerformCounter.NextValue() / SCALE;
                    }
                    ActivateSensor(processMemoryUsageShared);
                }
                else
                {
                    processMemoryUsageShared.Value = null;
                }
            }
            catch { processMemoryUsageShared.Value = null; }
        }
示例#13
0
        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();

            r.AppendLine("ADL Overdrive");
            r.AppendLine();
            int status = ADL.ADL_Overdrive_Caps(adapterIndex,
                                                out int supported, out int enabled, out int version);

            r.Append(" Status: ");
            r.AppendLine(status == ADL.ADL_OK ? "OK" :
                         status.ToString(CultureInfo.InvariantCulture));
            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));
            r.AppendLine();

            if (context != IntPtr.Zero && overdriveVersion >= 6)
            {
                r.AppendLine("Overdrive6 CurrentPower:");
                r.AppendLine();
                for (int i = 0; i < 4; i++)
                {
                    var pt = ((ADLODNCurrentPowerType)i).ToString();
                    var ps = ADL.ADL2_Overdrive6_CurrentPower_Get(
                        context, adapterIndex, (ADLODNCurrentPowerType)i,
                        out int power);
                    if (ps == ADL.ADL_OK)
                    {
                        r.AppendFormat(" Power[{0}].Value: {1}{2}", pt,
                                       power * (1.0f / 0xFF), Environment.NewLine);
                    }
                    else
                    {
                        r.AppendFormat(" Power[{0}].Status: {1}{2}", pt,
                                       ps, Environment.NewLine);
                    }
                }
                r.AppendLine();
            }

            if (context != IntPtr.Zero && overdriveVersion >= 7)
            {
                r.AppendLine("OverdriveN Temperature:");
                r.AppendLine();
                for (int i = 1; i < 8; i++)
                {
                    var tt = ((ADLODNTemperatureType)i).ToString();
                    var ts = ADL.ADL2_OverdriveN_Temperature_Get(
                        context, adapterIndex, (ADLODNTemperatureType)i,
                        out int temperature);
                    if (ts == ADL.ADL_OK)
                    {
                        r.AppendFormat(" Temperature[{0}].Value: {1}{2}", tt,
                                       0.001f * temperature, Environment.NewLine);
                    }
                    else
                    {
                        r.AppendFormat(" Temperature[{0}].Status: {1}{2}", tt,
                                       ts, Environment.NewLine);
                    }
                }
                r.AppendLine();
            }

            if (context != IntPtr.Zero && overdriveVersion >= 8)
            {
                r.AppendLine("Performance Metrics:");
                r.AppendLine();
                var ps = ADL.ADL2_New_QueryPMLogData_Get(context, adapterIndex,
                                                         out var data);

                if (ps == ADL.ADL_OK)
                {
                    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);
                        }
                    }
                }
                else
                {
                    r.Append(" Status: ");
                    r.AppendLine(ps.ToString(CultureInfo.InvariantCulture));
                }
                r.AppendLine();
            }

            return(r.ToString());
        }
示例#14
0
        public ATIGPU(string name, int adapterIndex, int busNumber,
                      int deviceNumber, IntPtr context, ISettings settings)
            : base(name, new Identifier("atigpu",
                                        adapterIndex.ToString(CultureInfo.InvariantCulture)), settings)
        {
            this.adapterIndex = adapterIndex;
            this.busNumber    = busNumber;
            this.deviceNumber = deviceNumber;

            this.context = context;

            if (ADL.ADL_Overdrive_Caps(adapterIndex, out _, out _,
                                       out overdriveVersion) != ADL.ADL_OK)
            {
                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);
            //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);
            this.temperaturePlx =
                new Sensor("GPU PLX", 8, SensorType.Temperature, this, settings);
            this.temperatureHotSpot =
                new Sensor("GPU Hot Spot", 9, SensorType.Temperature, this, settings);

            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);
            this.powerSoc    = new Sensor("GPU SOC", 4, SensorType.Power, this, settings);

            this.fan = new Sensor("GPU Fan", 0, SensorType.Fan, this, settings);

            this.coreClock   = new Sensor("GPU Core", 0, SensorType.Clock, this, settings);
            this.memoryClock = new Sensor("GPU Memory", 1, SensorType.Clock, this, settings);
            this.socClock    = new Sensor("GPU SOC", 2, SensorType.Clock, this, settings);

            this.coreVoltage   = new Sensor("GPU Core", 0, SensorType.Voltage, this, settings);
            this.memoryVoltage = new Sensor("GPU Memory", 1, SensorType.Voltage, this, settings);
            this.socVoltage    = new Sensor("GPU SOC", 2, SensorType.Voltage, this, settings);

            this.coreLoad             = new Sensor("GPU Core", 0, SensorType.Load, this, settings);
            this.memoryControllerLoad = new Sensor("GPU Memory Controller", 1, SensorType.Load, this, settings);

            try
            {
                if (PerformanceCounterCategory.Exists("GPU Adapter Memory"))
                {
                    var category  = new PerformanceCounterCategory("GPU Adapter Memory");
                    var instances = category.GetInstanceNames();

                    var(Usage, Index) = instances
                                        .Select(instance => new PerformanceCounter("GPU Adapter Memory", "Dedicated Usage", instance))
                                        .Select((u, i) => (Usage: u.RawValue, Index: i)).Max();

                    dedicatedVramUsagePerformCounter = new PerformanceCounter("GPU Adapter Memory", "Dedicated Usage", instances[Index]);
                    sharedVramUsagePerformCounter    = new PerformanceCounter("GPU Adapter Memory", "Shared Usage", instances[Index]);

                    this.memoryUsageDedicated = new Sensor("GPU Memory Dedicated", 0, SensorType.SmallData, this, settings);
                    this.memoryUsageShared    = new Sensor("GPU Memory Shared", 1, SensorType.SmallData, this, settings);
                }
            }
            catch (Exception ex)
            {
                Log.Logger.Error(ex, "Error while creating GPU memory performance counter.");
            }

            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)
                != ADL.ADL_OK)
            {
                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;
            Update();
        }
示例#15
0
        public override void Update()
        {
            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);
            }
            else
            {
                ADLTemperature adlt = new ADLTemperature();
                if (ADL.ADL_Overdrive5_Temperature_Get(adapterIndex, 0, ref adlt)
                    == ADL.ADL_OK)
                {
                    temperatureCore.Value = 0.001f * adlt.Temperature;
                    ActivateSensor(temperatureCore);
                }
                else
                {
                    temperatureCore.Value = null;
                }
            }

            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)
                == ADL.ADL_OK)
            {
                fan.Value = adlf.FanSpeed;
                ActivateSensor(fan);
            }
            else
            {
                fan.Value = null;
            }

            adlf           = new ADLFanSpeedValue();
            adlf.SpeedType = ADL.ADL_DL_FANCTRL_SPEED_TYPE_PERCENT;
            if (ADL.ADL_Overdrive5_FanSpeed_Get(adapterIndex, 0, ref adlf)
                == ADL.ADL_OK)
            {
                controlSensor.Value = adlf.FanSpeed;
                ActivateSensor(controlSensor);
            }
            else
            {
                controlSensor.Value = null;
            }

            ADLPMActivity adlp = new ADLPMActivity();

            if (ADL.ADL_Overdrive5_CurrentActivity_Get(adapterIndex, ref adlp)
                == ADL.ADL_OK)
            {
                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;
            }
        }
示例#16
0
        public ATIGroup(ISettings settings)
        {
            try {
                var adlStatus  = ADL.ADL_Main_Control_Create(1);
                var adl2Status = ADL.ADL2_Main_Control_Create(1, out context);

                report.AppendLine("AMD Display Library");
                report.AppendLine();
                report.Append("ADL Status: ");
                report.AppendLine(adlStatus.ToString());
                report.Append("ADL2 Status: ");
                report.AppendLine(adl2Status.ToString());
                report.AppendLine();

                report.AppendLine("Graphics Versions");
                report.AppendLine();
                try {
                    var status = ADL.ADL_Graphics_Versions_Get(out var versionInfo);
                    report.Append(" Status: ");
                    report.AppendLine(status.ToString());
                    report.Append(" DriverVersion: ");
                    report.AppendLine(versionInfo.DriverVersion);
                    report.Append(" CatalystVersion: ");
                    report.AppendLine(versionInfo.CatalystVersion);
                    report.Append(" CatalystWebLink: ");
                    report.AppendLine(versionInfo.CatalystWebLink);
                } catch (DllNotFoundException) {
                    report.AppendLine(" Status: DLL not found");
                } catch (Exception e) {
                    report.AppendLine(" Status: " + e.Message);
                }
                report.AppendLine();

                if (adlStatus == ADLStatus.OK)
                {
                    int numberOfAdapters = 0;
                    ADL.ADL_Adapter_NumberOfAdapters_Get(ref numberOfAdapters);

                    report.Append("Number of adapters: ");
                    report.AppendLine(numberOfAdapters.ToString(CultureInfo.InvariantCulture));
                    report.AppendLine();

                    if (numberOfAdapters > 0)
                    {
                        ADLAdapterInfo[] adapterInfo = new ADLAdapterInfo[numberOfAdapters];
                        if (ADL.ADL_Adapter_AdapterInfo_Get(adapterInfo) == ADLStatus.OK)
                        {
                            for (int i = 0; i < numberOfAdapters; i++)
                            {
                                int isActive;
                                ADL.ADL_Adapter_Active_Get(adapterInfo[i].AdapterIndex,
                                                           out isActive);
                                int adapterID;
                                ADL.ADL_Adapter_ID_Get(adapterInfo[i].AdapterIndex,
                                                       out adapterID);

                                report.Append("AdapterIndex: ");
                                report.AppendLine(i.ToString(CultureInfo.InvariantCulture));
                                report.Append("isActive: ");
                                report.AppendLine(isActive.ToString(CultureInfo.InvariantCulture));
                                report.Append("AdapterName: ");
                                report.AppendLine(adapterInfo[i].AdapterName);
                                report.Append("UDID: ");
                                report.AppendLine(adapterInfo[i].UDID);
                                report.Append("Present: ");
                                report.AppendLine(adapterInfo[i].Present.ToString(
                                                      CultureInfo.InvariantCulture));
                                report.Append("VendorID: 0x");
                                report.AppendLine(adapterInfo[i].VendorID.ToString("X",
                                                                                   CultureInfo.InvariantCulture));
                                report.Append("BusNumber: ");
                                report.AppendLine(adapterInfo[i].BusNumber.ToString(
                                                      CultureInfo.InvariantCulture));
                                report.Append("DeviceNumber: ");
                                report.AppendLine(adapterInfo[i].DeviceNumber.ToString(
                                                      CultureInfo.InvariantCulture));
                                report.Append("FunctionNumber: ");
                                report.AppendLine(adapterInfo[i].FunctionNumber.ToString(
                                                      CultureInfo.InvariantCulture));
                                report.Append("AdapterID: 0x");
                                report.AppendLine(adapterID.ToString("X",
                                                                     CultureInfo.InvariantCulture));

                                if (!string.IsNullOrEmpty(adapterInfo[i].UDID) &&
                                    adapterInfo[i].VendorID == ADL.ATI_VENDOR_ID)
                                {
                                    bool found = false;
                                    foreach (ATIGPU gpu in hardware)
                                    {
                                        if (gpu.BusNumber == adapterInfo[i].BusNumber &&
                                            gpu.DeviceNumber == adapterInfo[i].DeviceNumber)
                                        {
                                            found = true;
                                            break;
                                        }
                                    }
                                    if (!found)
                                    {
                                        var nameBuilder = new StringBuilder(adapterInfo[i].AdapterName);
                                        nameBuilder.Replace("(TM)", " ");
                                        for (int j = 0; j < 10; j++)
                                        {
                                            nameBuilder.Replace("  ", " ");
                                        }
                                        var name = nameBuilder.ToString().Trim();

                                        hardware.Add(new ATIGPU(name,
                                                                adapterInfo[i].AdapterIndex,
                                                                adapterInfo[i].BusNumber,
                                                                adapterInfo[i].DeviceNumber, context, settings));
                                    }
                                }

                                report.AppendLine();
                            }
                        }
                    }
                }
            } catch (DllNotFoundException) { }
            catch (EntryPointNotFoundException e) {
                report.AppendLine();
                report.AppendLine(e.ToString());
                report.AppendLine();
            }
        }
示例#17
0
        public override void Update()
        {
            int adlt = 0;

            if (ADL.ADL_Overdrive6_Temperature_Get(adapterIndex, ref adlt) == ADL.ADL_OK)
            {
                temperature.Value = 0.001f * adlt;
                ActivateSensor(temperature);
            }
            else
            {
                temperature.Value = null;
            }

            ADLOD6FanSpeedInfo adlf = new ADLOD6FanSpeedInfo();

            adlf.iSpeedType = ADL.ADL_OD6_FANSPEED_TYPE_RPM;
            if (ADL.ADL_Overdrive6_FanSpeed_Get(adapterIndex, ref adlf) == ADL.ADL_OK)
            {
                fan.Value = adlf.iFanSpeedRPM;
                ActivateSensor(fan);
            }
            else
            {
                fan.Value = null;
            }

            //adlf = new _ADLOD6FanSpeedValue();
            adlf.iSpeedType = ADL.ADL_OD6_FANSPEED_TYPE_PERCENT;
            if (ADL.ADL_Overdrive6_FanSpeed_Get(adapterIndex, ref adlf) == ADL.ADL_OK)
            {
                controlSensor.Value = adlf.iFanSpeedPercent;
                ActivateSensor(controlSensor);
            }
            else
            {
                controlSensor.Value = null;
            }

            ADLOD6CurrentStatus adlcs = new ADLOD6CurrentStatus();

            if (ADL.ADL_Overdrive6_CurrentStatus_Get(adapterIndex, ref adlcs) == ADL.ADL_OK)
            {
                if (adlcs.iEngineClock > 0)
                {
                    coreClock.Value = 0.01f * adlcs.iEngineClock;
                    ActivateSensor(coreClock);
                }
                else
                {
                    coreClock.Value = null;
                }

                if (adlcs.iMemoryClock > 0)
                {
                    memoryClock.Value = 0.01f * adlcs.iMemoryClock;
                    ActivateSensor(memoryClock);
                }
                else
                {
                    memoryClock.Value = null;
                }
                int curval, defaultval = 0;
                if (ADL.ADL_Overdrive6_VoltageControl_Get(adapterIndex, out curval, out defaultval) != ADL.ADL_OK)
                {
                    coreVoltage.Value = 0.001f * curval;
                    ActivateSensor(coreVoltage);
                }
                else
                {
                    coreVoltage.Value = null;
                }

                coreLoad.Value = Math.Min(adlcs.iActivityPercent, 100);
                ActivateSensor(coreLoad);
            }
            else
            {
                coreClock.Value   = null;
                memoryClock.Value = null;
                coreVoltage.Value = null;
                coreLoad.Value    = null;
            }
        }
示例#18
0
 private void SetDefaultFanSpeed()
 {
     ADL.ADL_Overdrive5_FanSpeedToDefault_Set(adapterIndex, 0);
 }
        public ATIGroup(ISettings settings)
        {
            try {
                int status = ADL.ADL_Main_Control_Create(1);

                report.AppendLine("AMD Display Library");
                report.AppendLine();
                report.Append("Status: ");
                report.AppendLine(status == ADL.ADL_OK ? "OK" :
                                  status.ToString(CultureInfo.InvariantCulture));
                report.AppendLine();

                if (status == ADL.ADL_OK)
                {
                    int numberOfAdapters = 0;
                    ADL.ADL_Adapter_NumberOfAdapters_Get(ref numberOfAdapters);

                    report.Append("Number of adapters: ");
                    report.AppendLine(numberOfAdapters.ToString(CultureInfo.InvariantCulture));
                    report.AppendLine();

                    if (numberOfAdapters > 0)
                    {
                        ADLAdapterInfo[] adapterInfo = new ADLAdapterInfo[numberOfAdapters];
                        if (ADL.ADL_Adapter_AdapterInfo_Get(adapterInfo) == ADL.ADL_OK)
                        {
                            for (int i = 0; i < numberOfAdapters; i++)
                            {
                                int isActive;
                                ADL.ADL_Adapter_Active_Get(adapterInfo[i].AdapterIndex,
                                                           out isActive);
                                int adapterID;
                                ADL.ADL_Adapter_ID_Get(adapterInfo[i].AdapterIndex,
                                                       out adapterID);

                                report.Append("AdapterIndex: ");
                                report.AppendLine(i.ToString(CultureInfo.InvariantCulture));
                                report.Append("isActive: ");
                                report.AppendLine(isActive.ToString(CultureInfo.InvariantCulture));
                                report.Append("AdapterName: ");
                                report.AppendLine(adapterInfo[i].AdapterName);
                                report.Append("UDID: ");
                                report.AppendLine(adapterInfo[i].UDID);
                                report.Append("Present: ");
                                report.AppendLine(adapterInfo[i].Present.ToString(
                                                      CultureInfo.InvariantCulture));
                                report.Append("VendorID: 0x");
                                report.AppendLine(adapterInfo[i].VendorID.ToString("X",
                                                                                   CultureInfo.InvariantCulture));
                                report.Append("BusNumber: ");
                                report.AppendLine(adapterInfo[i].BusNumber.ToString(
                                                      CultureInfo.InvariantCulture));
                                report.Append("DeviceNumber: ");
                                report.AppendLine(adapterInfo[i].DeviceNumber.ToString(
                                                      CultureInfo.InvariantCulture));
                                report.Append("FunctionNumber: ");
                                report.AppendLine(adapterInfo[i].FunctionNumber.ToString(
                                                      CultureInfo.InvariantCulture));
                                report.Append("AdapterID: 0x");
                                report.AppendLine(adapterID.ToString("X",
                                                                     CultureInfo.InvariantCulture));

                                if (!string.IsNullOrEmpty(adapterInfo[i].UDID) &&
                                    adapterInfo[i].VendorID == ADL.ATI_VENDOR_ID)
                                {
                                    bool found = false;
                                    foreach (ATIGPU gpu in hardware)
                                    {
                                        if (gpu.BusNumber == adapterInfo[i].BusNumber &&
                                            gpu.DeviceNumber == adapterInfo[i].DeviceNumber)
                                        {
                                            found = true;
                                            break;
                                        }
                                    }
                                    if (!found)
                                    {
                                        hardware.Add(new ATIGPU(
                                                         adapterInfo[i].AdapterName.Trim(),
                                                         adapterInfo[i].AdapterIndex,
                                                         adapterInfo[i].BusNumber,
                                                         adapterInfo[i].DeviceNumber, settings));
                                    }
                                }

                                report.AppendLine();
                            }
                        }
                    }
                }
            } catch (DllNotFoundException) { }
            catch (EntryPointNotFoundException e) {
                report.AppendLine();
                report.AppendLine(e.ToString());
                report.AppendLine();
            }
        }
示例#20
0
        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();

            r.AppendLine("Overdrive Caps");
            r.AppendLine();
            try {
                var status = ADL.ADL_Overdrive_Caps(adapterIndex,
                                                    out int supported, out int enabled, out int version);
                r.Append(" Status: ");
                r.AppendLine(status.ToString());
                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();

            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();

            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: ");
                r.AppendLine(status.ToString());
                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: ");
                r.AppendLine(status.ToString());
                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: ");
                r.AppendLine(status.ToString());
                r.AppendFormat(" Value Percent: {0}{1}",
                               adlf.FanSpeed, Environment.NewLine);
            } catch (Exception e) {
                r.AppendLine(" Status: " + e.Message);
            }
            r.AppendLine();

            r.AppendLine("Overdrive5 CurrentActivity");
            r.AppendLine();
            try {
                var adlp   = new ADLPMActivity();
                var status = ADL.ADL_Overdrive5_CurrentActivity_Get(adapterIndex,
                                                                    ref adlp);
                r.Append(" Status: ");
                r.AppendLine(status.ToString());
                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");
                r.AppendLine();
                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);
                        if (status == ADLStatus.OK)
                        {
                            r.AppendFormat(" Power[{0}].Value: {1}{2}", pt,
                                           power * (1.0f / 0xFF), Environment.NewLine);
                        }
                        else
                        {
                            r.AppendFormat(" Power[{0}].Status: {1}{2}", pt,
                                           status.ToString(), Environment.NewLine);
                        }
                    }
                } catch (EntryPointNotFoundException) {
                    r.AppendLine(" Status: Entry point not found");
                } catch (Exception e) {
                    r.AppendLine(" Status: " + e.Message);
                }
                r.AppendLine();
            }

            if (context != IntPtr.Zero)
            {
                r.AppendLine("OverdriveN Temperature");
                r.AppendLine();
                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);
                        if (status == ADLStatus.OK)
                        {
                            r.AppendFormat(" Temperature[{0}].Value: {1}{2}", tt,
                                           0.001f * temperature, Environment.NewLine);
                        }
                        else
                        {
                            r.AppendFormat(" Temperature[{0}].Status: {1}{2}", tt,
                                           status.ToString(), Environment.NewLine);
                        }
                    }
                } catch (EntryPointNotFoundException) {
                    r.AppendLine(" Status: Entry point not found");
                } catch (Exception e) {
                    r.AppendLine(" Status: " + e.Message);
                }
                r.AppendLine();
            }

            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();
            }

            if (context != IntPtr.Zero)
            {
                r.AppendLine("Performance Metrics");
                r.AppendLine();
                try {
                    var status = ADL.ADL2_New_QueryPMLogData_Get(context, adapterIndex,
                                                                 out var data);
                    if (status == ADLStatus.OK)
                    {
                        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);
                            }
                        }
                    }
                    else
                    {
                        r.Append(" Status: ");
                        r.AppendLine(status.ToString());
                    }
                } catch (EntryPointNotFoundException) {
                    r.AppendLine(" Status: Entry point not found");
                } catch (Exception e) {
                    r.AppendLine(" Status: " + e.Message);
                }

                r.AppendLine();
            }

            return(r.ToString());
        }