Ejemplo n.º 1
0
        public void LoadGpuState()
        {
#if DEBUG
            VirtualRoot.Stopwatch.Restart();
#endif
            for (int i = 0; i < Count; i++)
            {
                uint power = adlHelper.GetPowerUsageByIndex(i);
                int  temp  = adlHelper.GetTemperatureByIndex(i);
                uint speed = adlHelper.GetFanSpeedByIndex(i);

                Gpu  gpu       = (Gpu)_gpus[i];
                bool isChanged = gpu.Temperature != temp || gpu.PowerUsage != power || gpu.FanSpeed != speed;
                gpu.Temperature = temp;
                gpu.PowerUsage  = power;
                gpu.FanSpeed    = speed;

                if (isChanged)
                {
                    VirtualRoot.Happened(new GpuStateChangedEvent(gpu));
                }
            }
#if DEBUG
            Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.{nameof(LoadGpuState)}");
#endif
        }
Ejemplo n.º 2
0
        public void LoadGpuState()
        {
            for (int i = 0; i < Count; i++)
            {
                uint power = adlHelper.GetPowerUsageByIndex(i);
                uint temp  = adlHelper.GetTemperatureByIndex(i);
                uint speed = adlHelper.GetFanSpeedByIndex(i);

                Gpu  gpu       = (Gpu)_gpus[i];
                bool isChanged = gpu.Temperature != temp || gpu.PowerUsage != power || gpu.FanSpeed != speed;
                gpu.Temperature = temp;
                gpu.PowerUsage  = power;
                gpu.FanSpeed    = speed;

                if (isChanged)
                {
                    VirtualRoot.Happened(new GpuStateChangedEvent(gpu));
                }
            }
        }