Ejemplo n.º 1
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
            {
                temperature.Value = null;
            }

            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;
            }
        }
Ejemplo n.º 2
0
 private void SetDefaultFanSpeed()
 {
     ADL.ADL_Overdrive5_FanSpeedToDefault_Set(adapterIndex, 0);
 }
Ejemplo n.º 3
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();
            }
        }