private Dictionary <string, float> ConvertMemorySettings(NvidiaGpuModel gpuModel)
        {
            Dictionary <string, float> memoryInfo = new Dictionary <string, float>();

            uint  totalMemory = gpuModel.GetMemorySettings.Values[0];
            uint  freeMemory  = gpuModel.GetMemorySettings.Values[4];
            float usedMemory  = Math.Max(totalMemory - freeMemory, 0);

            memoryInfo.Add("AdapterID", gpuModel.AdapterIndex);
            memoryInfo.Add("MemoryTotal", (float)totalMemory / 1024);
            memoryInfo.Add("MemoryFree", (float)freeMemory / 1024);
            memoryInfo.Add("MemoryUsed", usedMemory / 1024);
            memoryInfo.Add("MemoryLoad", 100f * usedMemory / totalMemory);

            return(memoryInfo);
        }
        private Dictionary <string, int> ConverCoolerSettings(NvidiaGpuModel gpuModel)
        {
            Dictionary <string, int> coolerInfo = new Dictionary <string, int>();
            int count = 0;

            foreach (NvCooler cooler in gpuModel.GetCoolerSettings.Cooler)
            {
                if (gpuModel.GetCoolerSettings.Count != count)
                {
                    coolerInfo.Add("CurrentSpeed", Convert.ToInt32(cooler.CurrentPolicy));
                    coolerInfo.Add("CurrentMin", Convert.ToInt32(cooler.CurrentMin));
                    coolerInfo.Add("CurrentMax", Convert.ToInt32(cooler.CurrentMax));
                    count++;
                }
                else
                {
                    break;
                }
            }

            return(coolerInfo);
        }
        private Dictionary <string, int> ConvertClockSettings(NvidiaGpuModel gpuModel)
        {
            Dictionary <string, int> clockInfo = new Dictionary <string, int>();

            uint[] clocks = gpuModel.GetClockSettings.Clock;
            if (clocks != null)
            {
                clockInfo.Add("GPU Core", Convert.ToInt32(0.001f * clocks[8]));
                if (clocks[30] != 0)
                {
                    clockInfo.Add("GPU Memory", Convert.ToInt32(0.0005f * clocks[30]));
                    clockInfo.Add("GPU Shader", Convert.ToInt32(0.001f * clocks[30]));
                }
                else
                {
                    clockInfo.Add("GPU Memory", Convert.ToInt32(0.001f * clocks[0]));
                    clockInfo.Add("GPU Shader", Convert.ToInt32(0.001f * clocks[14]));
                }
            }

            return(clockInfo);
        }
        private Dictionary <string, int> ConvertTemperatureSettings(NvidiaGpuModel gpuModel)
        {
            Dictionary <string, int> tempInfo = new Dictionary <string, int>();
            int count = 0;

            foreach (NvSensor sensor in gpuModel.GetThermalSettings.Sensor)
            {
                if (gpuModel.GetThermalSettings.Count != count)
                {
                    tempInfo.Add("CurrentTemp", Convert.ToInt32(sensor.CurrentTemp));
                    tempInfo.Add("MaximumTemp", Convert.ToInt32(sensor.DefaultMaxTemp));
                    tempInfo.Add("MinimumTemp", Convert.ToInt32(sensor.DefaultMinTemp));
                    tempInfo.Add("TargetTemp", Convert.ToInt32(sensor.Target));
                    count++;
                }
                else
                {
                    break;
                }
            }

            return(tempInfo);
        }