尝试使用硬件监视器API检索GPU数据时严重滞后

时间:2019-01-02 13:23:43

标签: c# gpu

使用Open Hardware Monitor API启用Gpu数据检索时,出现严重的滞后现象并冻结:任何想法为何?

        //Causes Severe Lag
        //GPU Usage openhardwaremonitor 
        //---------------------------
        Computer c = new Computer()
        {
            GPUEnabled = true
        };
        c.Open();

        foreach (var hardware in c.Hardware)
        {
            if (hardware.HardwareType == HardwareType.GpuNvidia)
            {
                hardware.Update();
                foreach (var sensor in hardware.Sensors)
                    if (sensor.SensorType == SensorType.Level)
                        label27.Text = sensor.Name + ": " +sensor.Value.GetValueOrDefault();
            }
            //
            if (hardware.HardwareType == HardwareType.GpuAti)
            {
                hardware.Update();
                foreach (var sensor in hardware.Sensors)
                    if (sensor.SensorType == SensorType.Level)
                        label27.Text = sensor.Name + ": " + sensor.Value.GetValueOrDefault();
            }
        }
        //----------------------------

0 个答案:

没有答案