コード例 #1
0
 private void GetOD6Power(ADLODNCurrentPowerType type, Sensor sensor)
 {
     if (ADL.ADL2_Overdrive6_CurrentPower_Get(context, adapterIndex, type,
                                              out int power) == ADLStatus.OK)
     {
         sensor.Value = power * (1.0f / 0xFF);
         ActivateSensor(sensor);
     }
     else
     {
         sensor.Value = null;
     }
 }
コード例 #2
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());
        }